Integration
spooning supports a modern toolchain by playing nicely with nyc and Travis CI.
Required Configuration
Ensure that the “test” script is defined in your package.json file.
If you’ve been following the convention set forth in Running Tests, it should look like this:
"scripts": {
"test": "node test/run.js"
}
or if using spooning-cli:
"scripts": {
"test": "spoon 'test/**/*.test.js'"
}
At this point you should be able to run your tests with the following command:
npm test
However you run your tests, the process should exit with a non-zero code if any tests
failed (or if other errors were encountered).
If you are using spooning-cli
or your run.js
script uses the provided exit
callback, there is nothing else you have to do.
Test Coverage Reports
Install nyc as a dev dependency to generate coverage reports for your tests:
npm install -D nyc
Define a “cover” script in your package.json file:
"scripts": {
"cover": "nyc npm test"
}
At this point you should be able to generate a test coverage report with the following command:
npm run cover
Continuous Integration
Travis CI calls npm test
by default for node projects and only requires that the command exits with a non-zero code
to indicate one or more tests failed so spooning is supported with no additional configuration.
Next Chapter
Continue to Customization for examples of how to customize the output and implement custom
Reporter
objects.