Objective
Run Mocha tests with npm run, without getting a ELIFECYCLE
error.
Background
After my last question on mocha and npm, I found that Mocha returns the number of failed tests as a result.
Now, when running a script with npm (via npm run
), the script must return 0, or the npm will throw a ELIFECYCLE
error and crash the execution of the script.
Problem
This is obviously incredibly dumb cumbersome, as when developing code, tests are supposed to fail. This is normal, and we don't want the code to crash every single time we miss an assertion.
This pretty much forces me to re-launch everything, and what I find mind blowing is that in previous versions of npm, this crashing behavior was not present.
Currently I am using npm version 3.10.3.
What I tried
After reading npm error ELIFECYCLE while running the test I see one possible solution. But since this one solution will suppress all kinds of errors (even the ones that should crash the app) I would rather not implement it.
Questions
- How can I run my tests in Mocha (knowing that some will fail) without completely crashing the whole application with a
ELIFECYCLE
error? - Is this issue fixed in more recent versions of npm? (What is the most recent version, since I can't find it anywhere?)
Any help with this will be most appreciated.