…that prints the details of the test failure error as soon as a test fails.
Why? I hate having to wait until my long test suite finishes to begin debugging why a test fails.
// ./test/mocha.opts | |
--reporter test/reporter.js |
// ./test/reporter.js | |
'use strict' | |
const inherits = require('util').inherits | |
const { Base, Spec } = require('mocha').reporters | |
const Reporter = function(runner) { | |
Spec.call(this, runner) | |
runner.on('fail', function (test, error) { | |
Base.list([test]) | |
}) | |
} | |
inherits(Reporter, Spec) | |
exports = module.exports = Reporter |