Last Updated: January 04, 2021
· devtyr

Working with 'npm test'

It is possible to run your tests using the Node Package Manager (NPM). Navigate to your node module and call

npm test

To get this work, there must be a test setting in the scripts section of your package.json, that looks something like this:

"scripts": {
  "test": "node test/testrunner.js"

test includes the command to be executed when calling npm test.

This is very helpful if you use e.g. github in combination with Travis CI.