Skip to content

Commit f114dfb

Browse files
feat: add support unstable_unmockModule
Closes #15079
1 parent 65a80ee commit f114dfb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/jest-runtime/src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,16 @@ export default class Runtime {
21592159
this._explicitShouldMock.set(moduleID, false);
21602160
return jestObject;
21612161
};
2162+
const unmockModule = (moduleName: string) => {
2163+
const moduleID = this._resolver.getModuleID(
2164+
this._virtualModuleMocks,
2165+
from,
2166+
moduleName,
2167+
{conditions: this.esmConditions},
2168+
);
2169+
this._explicitShouldMockModule.set(moduleID, false);
2170+
return jestObject;
2171+
};
21622172
const deepUnmock = (moduleName: string) => {
21632173
const moduleID = this._resolver.getModuleID(
21642174
this._virtualMocks,
@@ -2414,6 +2424,7 @@ export default class Runtime {
24142424
spyOn,
24152425
unmock,
24162426
unstable_mockModule: mockModule,
2427+
unstable_unmockModule: unmockModule,
24172428
useFakeTimers,
24182429
useRealTimers,
24192430
};

0 commit comments

Comments
 (0)