我正在尝试为与 CucumberJS 集成的 TestCafe 项目之一设置 WebStorm(链接:https://github.com/rquellh/testcafe-cucumber)。
到目前为止,我能够使用 WebStorm 帮助对调试配置进行排序,但是,当我调试项目时,它会向控制台抛出以下错误:
我正在传递以下 cucumber.js 参数:
--require testlab/**/step_definitions/*.js --tags @debug
在调试时,出现以下错误:
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
我希望调试能够正确执行,但是,它不起作用,我认为替代方法是编写一个 js 配置并按照 CucumberJS 文档页面中所述进行传递,但是,我不确定如何实现那个。
我们将不胜感激任何意见或帮助。
最佳答案
此错误仅在使用 --tags @debug
运行 cucumber 时发生,并且它不是特定于 IDE - 在终端中使用 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)
我不确定您为什么需要这个选项...据我所知,您的项目中没有标有 @debug
的场景。
我建议使用标准 Cucumber.js运行调试配置。它对我来说工作正常 - 测试运行,断点被击中:
关于testing - WebStorm 中针对 CucumberJS 和基于 TestCafe 的项目的调试配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57214388/