无法启动Cucumber + javascript

时间:2017-09-11 13:57:16

标签: javascript node.js selenium cucumber

我尝试从官方文档中启动第一个示例 https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md

  • 我使用的是Windows 7x64 bit,node.js 6.11
  • 我尝试了以下命令并得到了相同的结果

*

node_modules/cucumber/bin/cucumber.js autotests/cucumber-test/features/documentation.feature
node_modules\cucumber\bin\cucumber.js autotests\cucumber-test\features\documentation.feature
cucumber autotests\cucumber-test\features\documentation.feature
cucumber-js autotests\cucumber-test\features\documentation.feature

*

我收到以下错误

cucumber.js:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
    SyntaxError: missing ) after argument list
        at createScript (vm.js:56:10)
        at Object.runInThisContext (vm.js:97:10)
        at Module._compile (module.js:542:28)
        at Object.Module._extensions..js (module.js:579:10)
        at Module.load (module.js:487:32)
        at tryModuleLoad (module.js:446:12)
        at Function.Module._load (module.js:438:3)
        at Module.require (module.js:497:17)
        at require (internal/module.js:20:19)
        at getDefinitions (<path>\node_modules\cucumber\lib\cucumber\cli\profiles_loader.js:8:23)

我也尝试降级到黄瓜1.3.3,但它没有帮助

2 个答案:

答案 0 :(得分:0)

请尝试以下命令:

node_modules \ cucumber \ bin \ cucumber.js.cmd autotests \ cucumber-test \ features \ documentation.feature

答案 1 :(得分:0)

我找到了解决方案

1) npm init  -> and  define package.json
2) npm install cucumber@latest
3) node_modules\.bin\cucumber.js.cmd  <path>\myfeature.feature