Skip to content

Mocha test framework

Mocha is a JavaScript test framework running on both Node.js and in the browser. It provides functionality for testing both synchronous and asynchronous code with a very simple and similar interface.

Learn by example

Check out our example Mocha repository.

Installation and user guide

For more information about the installation of MochaJS and how to use it, please see Mocha Wiki. Please note that as of v6.0.0, Mocha requires Node.js v6.0.0 or newer.

Formatters

We fully support JSON format for Mochawesome.

Reporters

We recommend that you use the Mocha JSON output reporter to output JSON documents.

You could also use the JUnit Reporter for Mocha, but this will results in a lot of data loss for your reports. We don't recommend this.

The XUnit reporter is also available. It outputs an XUnit-compatible XML document, often applicable in CI servers. See the JUnit XML page for more info on XML. By default, it will output to the console. To write directly to a file, use --reporter-options output=filename.xml.

You can manually import these output file types to Calliope.

Contribute to this documentation

Our testing team does not have hands-on experience in setting up a MochaJS testing project. If you have information on MochaJS you think needs to be on this page, contact us.