Skip to content

Commit

Permalink
Update docs to detail resetModules: false behavior
Browse files Browse the repository at this point in the history
The documentation at the moment describes the behavior of Jest when
`resetModules` is set to `true`, but leaves the default/false case
unclarified. I had a misconception that the module registry would not be
reset at all in the false case, where it's still reset between different
test files. This misconception was clarified by SimienB in issue #6007.

The reporter of issue #4413 also had this question.

This commit updates the documentation of `resetModules` to explain the
default case more explicitly.
  • Loading branch information
gluxon committed Jul 5, 2018
1 parent 14e8bbf commit ce2fd32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- `[*]` Update all legacy links to jestjs.io ([#6622](https://github.com/facebook/jest/pull/6622))
- `[docs]` Add docs for 23.1, 23.2, and 23.3 ([#6623](https://github.com/facebook/jest/pull/6623))
- `[website]` Only test/deploy website if relevant files are changed ([#6626](https://github.com/facebook/jest/pull/6626))
- `[docs]` Describe behavior of `resetModules` option when set to `false` ([#6636](https://github.com/facebook/jest/pull/6636))

## 23.2.0

Expand Down
2 changes: 1 addition & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ Automatically reset mock state between every test. Equivalent to calling `jest.r

Default: `false`

If enabled, the module registry for every test file will be reset before running each individual test. This is useful to isolate modules for every test so that local module state doesn't conflict between tests. This can be done programmatically using [`jest.resetModules()`](#jest-resetmodules).
By default, each test file gets its own independent module registry. Enabling `resetModules` goes a step further and resets the module registry before running each individual test. This is useful to isolate modules for every test so that local module state doesn't conflict between tests. This can be done programmatically using [`jest.resetModules()`](#jest-resetmodules).

### `resolver` [string]

Expand Down

0 comments on commit ce2fd32

Please sign in to comment.