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.

Installation and user guide

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

Reporters

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

You could also use the Mocha JSON output reporter to output JSON documents.

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.