在这里尝试使用本教程:
https://github.com/lykmapipo/nodejs-cucumber-sample
nvm current的输出是:v10.12.0。
npm --version的输出是:6.4.1>
一旦调用npm test,就会得到下面的错误
> nodejs-cucumber-sample@0.0.1 test /home/gnuc/code/nodejs-cucumber-sample
> cucumber.js
sh: 1: cucumber.js: not found我不知道为何会这样。$PATH包括/home/gnuc/.nvm/versions/node/v10.12.0/bin。我已经使用了npm install cucumber -g和npm install cucumber
发布于 2019-09-01 21:37:11
确保您的package.json文件包括以下内容:"test": "cucumber-js"
所以看起来是这样的:
{
"name": "hellocucumber",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": **"cucumber-js"**
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cucumber": "^5.1.0"
}
}发布于 2019-10-02 12:20:57
因此,您需要实际调用npm包/库。我的package.json中定义了以下内容:
"scripts": {
"test": "node ./node_modules/.bin/cucumber-js"
},你也可以在这个电话中添加一些标签。
"scripts": {
"test": "node ./node_modules/.bin/cucumber-js --tags @RegressionTestSuite"
},这将运行所有顶部有@RegressionTestSuite的特性文件。
另外,我有一个带有时间戳的输出/结果文件。
"scripts": {
"test": "node ./node_modules/.bin/cucumber-js --tags @RegressionTestSuite --format json:./results/log_new_`date +%Y-%m-%m__%H-%M`.json""
},希望这能帮上忙。
发布于 2020-03-10 06:18:54
节点/节点_模块/黄瓜/bin/黄瓜-js
这个命令运行良好。
您得到sh:1: cucumber.js: not意味着首先要注意的是cucumber.js的路径
https://stackoverflow.com/questions/54408619
复制相似问题