当lint或Unit testcase失败时如何停止npm start?

我使用npm开始与lint和unit testing的情况下,如果lint或testing用例失败,npm不应该上api,但我无法做到。

这里是我使用的代码:

"scripts": { "start": "gulp lint & npm test & node src/server/index.js", "test": "mocha --timeout 10000" }, 

请帮助我为我做什么,我也在互联网上search,但没有得到正确的解决scheme。

你可以简单地重写这样的代码:

 "scripts": { "start": "gulp lint && npm test && node src/server/index.js", "test": "mocha --timeout 10000" }, 

如果以前的步骤包含错误,Double &&将永远不会开始执行节点服务器。

使用&&而不是&

 "scripts": { "start": "gulp lint && npm test && node src/server/index.js", "test": "mocha --timeout 10000" 

},