Skip to content

Commit

Permalink
Update Configuration.md (jestjs#7455)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeaholicguy authored and captain-yossarian committed Jul 18, 2019
1 parent 2e7cd1c commit e4bb456
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,26 @@ Default: `undefined`

This option allows the use of a custom global setup module which exports an async function that is triggered once before all test suites. This function gets Jest's `globalConfig` object as a parameter.

_Note: Any global variables that are defined through `globalSetup` can only be read in `globalTeardown`. You cannot retrieve globals defined here in your test suites._

Example:

```js
// setup.js
module.exports = async () => {
// ...
// Set reference to mongod in order to close the server during teardown.
global.__MONGOD__ = mongod;
};
```

```js
// teardown.js
module.exports = async function() {
await global.__MONGOD__.stop();
};
```

### `globalTeardown` [string]

Default: `undefined`
Expand Down

0 comments on commit e4bb456

Please sign in to comment.