File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -392,6 +392,12 @@ export interface Jest {
392
392
* real module).
393
393
*/
394
394
unmock ( moduleName : string ) : Jest ;
395
+ /**
396
+ * Indicates that the module system should never return a mocked version of
397
+ * the specified module when it is being imported (e.g. that it should always
398
+ * return the real module).
399
+ */
400
+ unstable_unmockModule ( moduleName : string ) : Jest ;
395
401
/**
396
402
* Instructs Jest to use fake versions of the global date, performance,
397
403
* time and timer APIs. Fake timers implementation is backed by
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ expect(
51
51
. setMock ( 'moduleName' , { a : 'b' } )
52
52
. setTimeout ( 6000 )
53
53
. unmock ( 'moduleName' )
54
+ . unstable_unmockModule ( 'moduleName' )
54
55
. useFakeTimers ( )
55
56
. useFakeTimers ( { legacyFakeTimers : true } )
56
57
. useRealTimers ( ) ,
@@ -183,6 +184,9 @@ expect(jest.setMock('moduleName')).type.toRaiseError();
183
184
expect ( jest . unmock ( 'moduleName' ) ) . type . toEqual < typeof jest > ( ) ;
184
185
expect ( jest . unmock ( ) ) . type . toRaiseError ( ) ;
185
186
187
+ expect ( jest . unstable_unmockModule ( 'moduleName' ) ) . type . toBe < typeof jest > ( ) ;
188
+ expect ( jest . unstable_unmockModule ( ) ) . type . toRaiseError ( ) ;
189
+
186
190
// Mock Functions
187
191
188
192
expect ( jest . clearAllMocks ( ) ) . type . toEqual < typeof jest > ( ) ;
You can’t perform that action at this time.
0 commit comments