Mocha.js: Reporters Cheat Sheet

Spec

Alias: Specspec

This is the default reporter. The Spec reporter outputs a hierarchical view nested just as the test cases are.

Dot Matrix

Alias: Dotdot

The Dot Matrix reporter is a series of characters which represent test cases. Failures highlight in red exclamation marks (!), pending tests with a blue comma (,), and slow tests as yellow. Good if you prefer minimal output.

Nyan

Alias: Nyannyan

Tap

Alias: TAPtap

Landing Strip

Alias: Landinglanding

List

Alias: Listlist

The List reporter outputs a simple specifications list as test cases pass or fail, outputting the failure details at the bottom of the output.

Progress

Alias: Progressprogress

The Progress reporter implements a simple progress-bar

Json

Alias: JSONjson

The JSON reporter outputs a single large JSON object when the tests have completed (failures or not).

Json Stream

Alias: JSONStreamjson-stream

The JSON Stream reporter outputs newline-delimited JSON “events” as they occur, beginning with a “start” event, followed by test passes or failures, and then the final “end” event.

Min

Alias: Minmin

The Min reporter displays the summary only, while still outputting errors on failure. This reporter works great with --watch as it clears the terminal in order to keep your test summary at the top.

Doc

Alias: Docdoc

The Doc reporter outputs a hierarchical HTML body representation of your tests. Wrap it with a header, footer, and some styling, then you have some fantastic documentation!

Markdown

Alias: Markdownmarkdown

The Markdown reporter generates a markdown TOC and body for your test suite. This is great if you want to use the tests as documentation within a Github wiki page, or a markdown file in the repository that Github can render.

XUnit

Alias: XUnitxunit

The XUnit reporter is also available. It outputs an XUnit-compatible XML document, often applicable in CI servers.

By default, it will output to the console. To write directly to a file, use --reporter-option output=filename.xml.

To specify a custom report title, use --reporter-option suiteName="Custom name".

Html Reporter

Alias: HTMLhtml

The HTML reporter is not intended for use on the command-line.

Leave a Reply

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