【发布时间】:2017-11-21 08:41:44
【问题描述】:
我正在为我的项目设置 nyc/mocha。在使用/不使用 nyc 运行 mocha 时,我想将 --exit 选项传递给 mocha。
这是我的 packages.json:
"scripts": {
"start": "node ./app",
"test": "./node_modules/.bin/mocha --exit",
"test-with-coverage": "nyc --reporter=html mocha --reporter mochawesome --exit",
"apidoc": "apidoc -i routes/ -o apidocs/"
}
但是当我运行 npm test 或 npm run test-with-coverage 时,这会引发无效选项错误。
如何将任何选项从 npm 传递给 mocha?
【问题讨论】:
-
不太确定,但你的命令中没有时间
--(在 html mocha 之后) -
即使删除
--后它也不起作用。 -
你确实试过这个
nyc --reporter=html mocha -- --reporter mochawesome?
标签: node.js unit-testing npm mocha.js nyc