Skip to content

Commit

Permalink
docs: add entry for isEnvironmentTornDown
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 15, 2023
1 parent 73d7c1d commit 928f6cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/JestObjectAPI.md
Expand Up @@ -555,6 +555,10 @@ test('works too', () => {

Returns the `jest` object for chaining.

### `jest.isEnvironmentTornDown(fn)`

Returns `true` if test environment has been torn down.

### `jest.isolateModules(fn)`

`jest.isolateModules(fn)` goes a step further than `jest.resetModules()` and creates a sandbox registry for the modules that are loaded inside the callback function. This is useful to isolate specific modules for every test so that local module state doesn't conflict between tests.
Expand Down
14 changes: 7 additions & 7 deletions packages/jest-environment/src/index.ts
Expand Up @@ -165,13 +165,6 @@ export interface Jest {
* Determines if the given function is a mocked function.
*/
isMockFunction: ModuleMocker['isMockFunction'];
/**
* `jest.isolateModules()` goes a step further than `jest.resetModules()` and
* creates a sandbox registry for the modules that are loaded inside the callback
* function. This is useful to isolate specific modules for every test so that
* local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): Jest;
/**
* Returns `true` if test environment has been torn down.
* @example
Expand All @@ -181,6 +174,13 @@ export interface Jest {
* }
*/
isEnvironmentTornDown(): boolean;
/**
* `jest.isolateModules()` goes a step further than `jest.resetModules()` and
* creates a sandbox registry for the modules that are loaded inside the callback
* function. This is useful to isolate specific modules for every test so that
* local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): Jest;
/**
* `jest.isolateModulesAsync()` is the equivalent of `jest.isolateModules()`, but for
* async functions to be wrapped. The caller is expected to `await` the completion of
Expand Down

0 comments on commit 928f6cc

Please sign in to comment.