The node-report module provides an easy-to-use general purpose diagnostic report for Node.js applications. It can be triggered automatically on uncaught exceptions or fatal errors, by OS signal, or by calling a JavaScript API. The module contains native (C++) code so that it can run when the V8 JavaScript engine has failed (for example in the case of an out-of-memory error), and so that it can obtain OS platform information, for example native stack traces and Linux ulimit settings.

Comprehensive testing of updates and new versions of the node-report module is important. The github repository for the module contains a set of tests in the /tests directory. These tests are written using the TAP test framework. The tests are structured with a JavaScript test program for each scenario in which node-report is being tested (for example on uncaught exception or on fatal error). The test programs are run as separate processes. A shared validation program (tests/common.js) then checks that the content of the generated node-report file is as expected. To install the node-report module and its prerequisites and run the tests use the following steps:

git clone
cd node-report
npm install
npm test

The output of a successful test run is as follows:

The node-report module contains code that is OS platform dependent, so it is important that the tests are run on a range of supported platforms. The node-report Continuous Integration (CI) build uses Jenkins to schedule tests on a list of machines. By default, the node-report CI build tests the latest master branch of the node-report module using the latest development level of Node.js, on all machines. The node-report branch, version of Node.js and machine selection can all be configured as required for a test run. An example Jenkins run is as follows:

Acknowledgments: thanks to Richard Lau for converting the node-report tests to use tap, and for extending the test coverage. Thanks to Michael Dawson, Gibson Fahnestock and George Adams for setting up the CI build.

Join The Discussion

Your email address will not be published. Required fields are marked *