Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ce2fd32

Browse files
committedJul 5, 2018
Update docs to detail resetModules: false behavior
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.
1 parent 14e8bbf commit ce2fd32

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- `[*]` Update all legacy links to jestjs.io ([#6622](https://github.com/facebook/jest/pull/6622))
2222
- `[docs]` Add docs for 23.1, 23.2, and 23.3 ([#6623](https://github.com/facebook/jest/pull/6623))
2323
- `[website]` Only test/deploy website if relevant files are changed ([#6626](https://github.com/facebook/jest/pull/6626))
24+
- `[docs]` Describe behavior of `resetModules` option when set to `false` ([#6636](https://github.com/facebook/jest/pull/6636))
2425

2526
## 23.2.0
2627

‎docs/Configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ Automatically reset mock state between every test. Equivalent to calling `jest.r
523523

524524
Default: `false`
525525

526-
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).
526+
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).
527527

528528
### `resolver` [string]
529529

0 commit comments

Comments
 (0)
Please sign in to comment.