使用NPM 5,运行npm test:
"scripts": {
"build": "babel src -d dist",
"test": "npm run build; mocha --require 'babel-polyfill' --compilers js:babel-register './tests/**/*.spec.js'"
},
我收到此错误:
npm ERR! missing script: build;
使用NPM 2没有任何问题
如果我替换npm run build; => babel src -d dist,我收到了这个错误:
mocha doesn't exist. './tests/**/*.spec.js' doesn't exist
但已安装mocha并测试文件夹外观。
答案 0 :(得分:0)
尝试检查错误,并创建了此代码:
{
...
"scripts": {
"build": "echo 'building'",
"test": "npm run build && echo 'testing'"
},
...
}
然后我就跑了:
npm test
这是我的输出:
building
testing
npm - 5.0.3
所以试着替换“;”与“&&”在npm测试中