File tree 2 files changed +11
-1
lines changed
packages/jest-runtime/src
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ class Runtime {
155
155
private _virtualMocks : BooleanObject ;
156
156
private _moduleImplementation ?: typeof nativeModule . Module ;
157
157
private jestObjectCaches : Map < string , Jest > ;
158
+ private _hasWarnedAboutRequireCacheModification = false ;
158
159
159
160
constructor (
160
161
config : Config . ProjectConfig ,
@@ -1302,7 +1303,13 @@ class Runtime {
1302
1303
moduleRequire . resolve = resolve ;
1303
1304
moduleRequire . cache = ( ( ) => {
1304
1305
const notPermittedMethod = ( ) => {
1305
- console . warn ( '`require.cache` modification is not permitted' ) ;
1306
+ if ( ! this . _hasWarnedAboutRequireCacheModification ) {
1307
+ this . _environment . global . console . warn (
1308
+ '`require.cache` modification is not permitted' ,
1309
+ ) ;
1310
+
1311
+ this . _hasWarnedAboutRequireCacheModification = true ;
1312
+ }
1306
1313
return true ;
1307
1314
} ;
1308
1315
return new Proxy < RequireCache > ( Object . create ( null ) , {
Original file line number Diff line number Diff line change 8
8
// Some of the `jest-runtime` tests are very slow and cause
9
9
// timeouts on travis
10
10
jest . setTimeout ( 70000 ) ;
11
+
12
+ // this module does some funky stuff with `require.cache`, flooding the terminal with output
13
+ jest . mock ( 'stealthy-require' , ( ) => ( _ , m ) => m ( ) ) ;
You can’t perform that action at this time.
0 commit comments