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 f88db2b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/JestObjectAPI.md
Expand Up @@ -568,6 +568,20 @@ 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 f88db2b

Please sign in to comment.