From 61d4433982fb7662d79a2980231414bd604136e2 Mon Sep 17 00:00:00 2001 From: Brandon Cheng Date: Thu, 5 Jul 2018 18:09:57 -0400 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + docs/Configuration.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6c4c536b726..9d12abb5276b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` ([#6641](https://github.com/facebook/jest/pull/6641)) ## 23.2.0 diff --git a/docs/Configuration.md b/docs/Configuration.md index 7266c12c6791..5ea2f8292335 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -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]