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:

Using The --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:

module.exports = {
  write : function(results, options, done) {
    done();
  }
};

The reporter method in your external globals

Add your reporter in the external globals file. Read more about external globals.

See the provided globalsModule.js for an example.

Example:


module.exports = {
  reporter : function(results, done) {
    console.log(results);
    done();
  }
};
Improve this article