meteortesting:mocha-core

v8.1.2Published 2 years ago

meteortesting:mocha-core

This is an internal package. Please use meteortesting:mocha

In-/Decrease default test timeout

In case you want to in- or decrease the default timeout of 2000 ms, you can set the environment variable MOCHA_TIMEOUT in your shell which will be picked up by this library and passed on to the mocha instance.

Mocha configuration with .mocharc file

You can configure the mocha runner with a .mocharc.js or a .mocharc.json file at the root of your Meteor app. This package uses mocha programmatically, so it supports a constrained list of options.

If both files are defined, .mocharc.js will overwrite the settings in .mocharc.json.

The setting timeout will be overwritten if the environment variable MOCHA_TIMEOUT is set.

  • Read more about using mocha and supported options here.
  • You can find examples of config files here.

Example

Feel free to start with this file as an example:

1module.exports = {
2  forbidOnly: process.env.IS_CI, // You could set this variable inside your continuous integration platform
3  retries: 2,
4  slow: 200,
5  timeout: 10000,
6  grep: 'hello' // Only runs tests whose name contains this
7};