Skip to main content

MochaConfig

Configuration object for the Mocha test runner.

Learn more

Index

Properties

optionalconfig

config?: string

Path to config file.

Learn more

optionalallow-uncaught

allow-uncaught?: boolean

Allow uncaught errors to propagate.

optionalasync-only

async-only?: boolean

Require all tests to use a callback (async) or return a Promise.

optionalbail

bail?: boolean

Abort (“bail”) after first test failure.

optionalcheck-leaks

check-leaks?: boolean

Check for global variable leaks.

optionaldelay

delay?: boolean

Delay initial execution of root suite.

optionalfgrep

fgrep?: string

Only run tests containing this string.

Note: MochaConfig.fgrep and MochaConfig.grep are mutually exclusive.

optionalfile

file?: string[]

Files to be loaded prior to root suite execution.

optionalforbid-only

forbid-only?: boolean

Fail if exclusive test(s) encountered.

forbid-pending

forbid-pending: boolean

Fail if pending test(s) encountered.

optionalglobal

global?: string[]

List of allowed global variables.

optionalgrep

grep?: string | RegExp

Only run tests matching this string or regexp.

Note: MochaConfig.grep and MochaConfig.fgrep are mutually exclusive.

optionalgrowl

growl?: boolean

Enable Growl notifications.

optionalinvert

invert?: boolean

Inverts MochaConfig.grep and MochaConfig.fgrep matches.

optionalrequire

require?: string[]

Require module.

optionalretries

retries?: number

Retry failed tests this many times.

optionalslow

slow?: number

Specify “slow” test threshold (in milliseconds).

optionaltimeout

timeout?: number

Specify test timeout threshold (in milliseconds).

Note: setting this property to 0 means “no timeout”.

optionalui

ui?: string

Specify user interface. Defaults to bdd.

Learn more

optionalstrict

strict?: boolean

When set to true, a skipped test is considered a failure.