Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support code aliases break step definition stacktrace (v2.3.0) #846

Closed
pittgoose opened this issue Jun 6, 2017 · 4 comments · Fixed by #881
Closed

Support code aliases break step definition stacktrace (v2.3.0) #846

pittgoose opened this issue Jun 6, 2017 · 4 comments · Fixed by #881

Comments

@pittgoose
Copy link

I'm using the JSON formatter to report on my tests.
I just upgraded to cucumber 2.3.0 and I changed some step definition files to use the new aliases to define my steps as such:

let {When, Then} = require('cucumber');

When(/^I define a step here$/, () => {
...
});

This results in the json file looking like this:

"steps": [
          {
           "arguments": [],
            "keyword": "When ",
            "name": "I define a step here",
            "result": {
              "status": "passed",
              "duration": 4156
            },
            "line": 16,
            "match": {
              "location": "C:\\<project-root>\\node_modules\\cucumber\\lib\\index.js:176"
            }
          }
...
]

But if I change my SD file to use defineSupportCode like this:


let {defineSupportCode} = require('cucumber');
defineSupportCode(({When}) => {
    When(/^I define a step here$/, () => {
        ...
    });
})

I get the proper references to my step location:

"steps": [
          {
           "arguments": [],
            "keyword": "When ",
            "name": "I define a step here",
            "result": {
              "status": "passed",
              "duration": 4156
            },
            "line": 16,
            "match": {
              "location": "C:\\<project-root>\\e2e\\step_definitions\\common-steps.ts:12"
            }
          }
...
]

@charlierudolph This is something you just worked on. Could we collab on a solution?

@charlierudolph
Copy link
Member

Danget. Yep thats an error caused by the recent changes. Should be easy to add a feature test for this.

The code currently assumes the user is calling defineSupportCode and thus looking a specific number of stackframes back. We could update it to search for the first stackframe that does not include /node_nodules/cucumber

@pittgoose
Copy link
Author

@charlierudolph I sent you a message on Gitter (don't know if you use it). I'd like to PR this but I'm getting stuck.

@charlierudolph
Copy link
Member

@pittgoose sorry I'm not reliably on gitter. You can open a work in progress PR and I can help out there

@pittgoose pittgoose changed the title Support code aliases break JSON formatter (v2.3.0) Support code aliases break step definition stacktrace (v2.3.0) Jun 13, 2017
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants