Running of tests fails when mocha is not installed globally.
Test suite depends that the system has it somewhere,
but it does not get installed automatically by the package.json file.
When running npm test command, test suite failed with the following error messages:
[02:29:35] Finished 'test:unit' after 2.07 s
[02:29:35] Starting 'test:angular'...
[02:29:35] Starting 'test:angular:unit'...
WARN `start` method is deprecated since 0.13. It will be removed in 0.14. Please use
server = new Server(config, [done])
server.start()
instead.
[02:29:35] 'test:angular:unit' errored after 144 ms
[02:29:35] Error: Cannot find module 'mocha'
at Function.Module._resolveFilename (module.js:489:15)
at Function.resolve (internal/module.js:18:19)
…
[02:29:35] 'test' errored after 2.22 s
[02:29:35] Error in plugin 'run-sequence'
Message:
An error occured in task 'test:angular:unit'.
[02:29:35] 'test:angular' errored after 149 ms
[02:29:35] Error in plugin 'run-sequence'
Message:
An error occured in task 'test'.
[02:29:35] 'test:angular' errored after 150 ms
[02:29:35] Error in plugin 'run-sequence'
Message:
An error occured in task 'test:angular:unit'.
npm ERR! Test failed. See above for more details.
I understand that different applications might use different versions of mocha.
Still, it would be logical that the test suite would depend on a specified version of the required tool,
as it would make it more reliable to run tests on a new computer or virtual machine (without need to manually setup unlisted requirements).
Way to solve this issue would be to add mocha to development dependencies with:
npm install --save-dev mocha
Tried this, and then did re-run the test suite. Worked nicely after that.
My suggestion is to add the updated dependencies to the package.json for the future developers.
Running of tests fails when
mocha
is not installed globally. Test suite depends that the system has it somewhere, but it does not get installed automatically by thepackage.json
file.When running
npm test
command, test suite failed with the following error messages:I understand that different applications might use different versions of mocha. Still, it would be logical that the test suite would depend on a specified version of the required tool, as it would make it more reliable to run tests on a new computer or virtual machine (without need to manually setup unlisted requirements).
Way to solve this issue would be to add
mocha
to development dependencies with:Tried this, and then did re-run the test suite. Worked nicely after that. My suggestion is to add the updated dependencies to the
package.json
for the future developers.