Skip to content
  • Sponsor mochajs/mocha-examples

  • Notifications You must be signed in to change notification settings
  • Fork 157

Files

third-party-reporter

Third-party reporter

Mocha supports third-party reporters that can support advanced or specific use-cases. A reporter wraps around a Runner object and optionally listens to the events it emits.

To use a reporter published on npm (e.g., lcov-reporter), install it locally and set --reporter lcov-reporter. Alternatively, you can set the reporter in .mocharc.json as we've done here.

It is a very similar setup for third party UI's.

For more details, including a list of which argument types go with which runner event, see Tutorial: Create a Custom Reporter.

Commands

  • npm test - run tests to validate lib/my-reporter.js
  • npm run test:unit - run tests to see the output of lib/my-reporter.js on failing tests