Create custom reporters
Overview
If you'd like to define your own reporter in addition to the built-in ones (stdout and jUnit-xml) you can do so in two ways:
--reporter
command-line argument
Define your reporter in a separate file, using the below interface, and then specify the path to the file using the --reporter
cli argument.
Interface:
custom_reporter.js
module.exports = {
write : function(results, options, done) {
done();
}
};
via external globals
Add your reporter in the external globals file. Read more about external globals.
See the provided globalsModule.js for an example.
Example:
globals.js
module.exports = {
reporter : function(results, done) {
console.log(results);
done();
}
};