And when I run the command npm test in cmd, the test run alright
No they aren't. You have 6 failing tests. The exit code of mocha-phantomjs
is equal to the number of failing tests. Run mocha-phantomjs ./test/FlickrTest.html
directly and see what is failing. Realize the PhantomJS is a bit different than your browser - you may have to debug it.
Your script setup is odd. You should just have:
"scripts": {
"test": "mocha-phantomjs ./test/FlickrTest.html"
}
Then the odd node errors should go away.