Skip to content

Commit

Permalink
add website docs for isolateModulesAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
CircleCI committed Dec 19, 2022
1 parent de40383 commit 2cf0d73
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/JestObjectAPI.md
Expand Up @@ -568,6 +568,21 @@ jest.isolateModules(() => {
const otherCopyOfMyModule = require('myModule');
```

### `jest.isolateModulesAsync(fn)`

`jest.isolateModulesAsync()` is the equivalent of `jest.isolateModules()`, but for async functions that need to be wrapped.
The caller is expected to `await` the completion of `isolateModulesAsync`.

```js
let myModule;
await jest.isolateModulesAsync(async () => {
constmyModule = require('myModule');
// do async stuff here
});

const otherCopyOfMyModule = require('myModule');
```

## Mock Functions

### `jest.fn(implementation?)`
Expand Down

0 comments on commit 2cf0d73

Please sign in to comment.