I have identified two issues with the command you provided:
mocha ./tests/flickr/mytest --reporter junit-reporter
The first issue is that the mocha
command used here is from the global node module. However, when running npm test
, it should be targeting the local mocha
command within our node_modules
folder.
The second issue is that the reporter name should be changed to mocha-junit-reporter
instead of junit-reporter
Solution
A workaround is to use the local mocha
command like this:
./node_modules/.bin/mocha ./tests/flickr/mytest --reporter mocha-junit-reporter
This is the preferred solution.
Alternatively, you can install mocha-junit-reporter
globally with the following commands:
npm install -g mocha-junit-reporter
mocha ./tests/flickr/mytest --reporter mocha-junit-reporter
This method may not be ideal as it could lead to using different versions of mocha and mocha-junit-reporter in the global scope compared to the local node modules.
Cheers