Mocha Test Failing To Run On Nodejs Server
Solution 1:
TL;DR
This is somehow an expected behavior from npm run
.
Explanation
After a long time of searching, I found a threat that lead me in the right way:
What happens here, is that mocha returns the number of failed tests. So if all tests pass, mocha returns 0 and npm continues without throwing an exception.
If however, X tests fail, mocha will return X. Because the returned result from running the script is different from 0, npm will throw an exception with code X and will fail execution.
Venting
Personally, this behavior is crap. I don't know who to blame here, if mocha for returning an arbitrary number when an arbitrary number of tests fail, is npm for refusing anything other than 0, or me, for apparently not knowing how to run tests, or at least keep up with the technologies to do so ....
Now I need to go on and find a decent way to run tests using mocha and npm. Hoping this helps someone.
Post a Comment for "Mocha Test Failing To Run On Nodejs Server"