Reputation: 577
I am using npm start with lint and unit test case, if lint or test case fails, npm should not up the api, but I am not able to do.
Here is code I am using:
"scripts": {
"start": "gulp lint & npm test & node src/server/index.js",
"test": "mocha --timeout 10000"
},
Please help me what I have to do for it, I searched on internet also, but not getting the proper solution.
Upvotes: 1
Views: 757
Reputation: 1977
Use &&
instead of &
:
"scripts": {
"start": "gulp lint && npm test && node src/server/index.js",
"test": "mocha --timeout 10000"
},
Upvotes: 2
Reputation: 450
You can simply rewrite the code like this:
"scripts": {
"start": "gulp lint && npm test && node src/server/index.js",
"test": "mocha --timeout 10000"
},
Double && will never start execution of node server if previous steps contains errors.
Upvotes: 2