Reputation: 141
I am trying to set up WebStorm for one of the TestCafe project integrated with CucumberJS (Link: https://github.com/rquellh/testcafe-cucumber).
I am able to sort the debug configuration so far using WebStorm help, however, when I debug the project, it throws the following error to the console:
I am passing the following cucumber.js arguments:
--require testlab/**/step_definitions/*.js --tags @debug
And while I debug, I get the following error:
ReferenceError: testController is not defined
at World.<anonymous>
Test ignored.
Test ignored.
Failures:
1) Scenario: Searching for TestCafe on GitHub #
testlab\features\finAPIDemo.feature:6
× Given I open the GitHub page # testlab\step_definitions\github.js:5
ReferenceError: testController is not defined
I am expecting the debug to execute correctly, however, it is not working, the alternative I believe would be to write a js config and pass through as mentioned in the CucumberJS document page, however, I am not sure how to achieve that.
Any input or help will be appreciated.
Upvotes: 1
Views: 700
Reputation: 141
Under the hooks.js I have updated the import statements with const assignment and that worked for me:
Replaced:
'import errorHandling from "./support/errorHandling.js";\n' +
'import testControllerHolder from "./support/testControllerHolder.js";\n\n' +
with
'const errorHandling = require("./support/errorHandling.js");\n' +
'const testControllerHolder = require("./support/testControllerHolder.js");\n\n' +
Upvotes: 1
Reputation: 5227
You need to add the @debug
directive for the scenario that you want to debug.
See the full setup in this help topic.
Upvotes: 3
Reputation: 93848
This error only occurs when running cucumber with --tags @debug
, and it's not specific to the IDE - you will face the same issue when starting your tests in terminal with node node_modules/cucumber/bin/cucumber-js --tags @debug
:
node node_modules/cucumber/bin/cucumber-js --tags @debug
0 scenarios
0 steps
0m00.000s
E:\WebstormProjects\testcafe-cucumber\features\support\hooks.js:77
if (testController.testRun.lastDriverStatusResponse === 'test-done-confirmation') {
^
ReferenceError: testController is not defined
at Timeout.checkLastResponse [as _onTimeout] (E:\WebstormProjects\testcafe-cucumber\features\support\hooks.js:77:9)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
I'm not sure why you need this option... There are no scenarios marked with @debug
in your project, as far as I can see.
I'd suggest using a standard Cucumber.js run configuration for debugging. It works fine for me - tests are run, and breakpoints are hit:
Upvotes: 3
Reputation: 1214
I would recommend using cucumber profiles and call that profile instead of using cli commands. Looking at the error you are receiving it looks like you are missing more required directories such as a custom world directory?
Upvotes: 1