diff --git a/CHANGELOG.md b/CHANGELOG.md index b1dbc41bd099..da9dba4496f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ ### Fixes -- `[matcher-utils]` Correct diff for expected asymmetric matchers ([#12264](https://github.com/facebook/jest/pull/12264)) - `[expect]` Add a fix for `.toHaveProperty('')` ([#12251](https://github.com/facebook/jest/pull/12251)) +- `[@jest/globals]` Add missing `options` argument to `jest.doMock` typing ([#12292](https://github.com/facebook/jest/pull/12292)) - `[jest-environment-node]` Add `atob` and `btoa` ([#12269](https://github.com/facebook/jest/pull/12269)) +- `[jest-matcher-utils]` Correct diff for expected asymmetric matchers ([#12264](https://github.com/facebook/jest/pull/12264)) - `[jest-message-util]` Fix `.getTopFrame()` (and `toMatchInlineSnapshot()`) with `mjs` files ([#12277](https://github.com/facebook/jest/pull/12277)) ### Chore & Maintenance diff --git a/packages/jest-environment/src/index.ts b/packages/jest-environment/src/index.ts index b5920f7d00e9..509a4dac4fad 100644 --- a/packages/jest-environment/src/index.ts +++ b/packages/jest-environment/src/index.ts @@ -92,7 +92,11 @@ export interface Jest { * the top of the code block. Use this method if you want to explicitly avoid * this behavior. */ - doMock(moduleName: string, moduleFactory?: () => unknown): Jest; + doMock( + moduleName: string, + moduleFactory?: () => unknown, + options?: {virtual?: boolean}, + ): Jest; /** * Indicates that the module system should never return a mocked version * of the specified module from require() (e.g. that it should always return diff --git a/packages/jest-types/__typechecks__/jest.test.ts b/packages/jest-types/__typechecks__/jest.test.ts index 1c0a5483ca56..a1d60669698f 100644 --- a/packages/jest-types/__typechecks__/jest.test.ts +++ b/packages/jest-types/__typechecks__/jest.test.ts @@ -20,9 +20,8 @@ expectType(jest.deepUnmock('moduleName')); expectType(jest.disableAutomock()); expectType(jest.doMock('moduleName')); expectType(jest.doMock('moduleName', jest.fn())); - -expectError(jest.doMock('moduleName', jest.fn(), {})); -expectError(jest.doMock('moduleName', jest.fn(), {virtual: true})); +expectType(jest.doMock('moduleName', jest.fn(), {})); +expectType(jest.doMock('moduleName', jest.fn(), {virtual: true})); expectType(jest.dontMock('moduleName')); expectType(jest.enableAutomock());