File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
- import Module , { getModuleParent } from './module' ;
2
- import wipeCache from './wipeCache' ;
1
+ import Module , { getModuleName , getModuleParent } from './module' ;
2
+ import wipeCache , { safelyRemoveCache } from './wipeCache' ;
3
3
import createScope from './scope' ;
4
4
import { getScopeVariable , setScope } from './globals' ;
5
5
import {
@@ -322,11 +322,12 @@ mockModule.clear = () => {
322
322
} ;
323
323
324
324
const cleanup = ( ) => {
325
- delete require . cache [ require . resolve ( __filename ) ] ;
325
+ safelyRemoveCache ( getModuleName ( module ) ) ;
326
326
} ;
327
327
328
328
329
329
const addPlugin = ( plugin ) => {
330
+ plugin . init ( ) ;
330
331
scope ( ) ;
331
332
addPluginAPI ( plugin ) ;
332
333
} ;
Original file line number Diff line number Diff line change 1
1
import * as API from './mockModule' ;
2
- delete require . cache [ require . resolve ( __filename ) ] ;
2
+ import { safelyRemoveCache } from "./wipeCache" ;
3
+ import { getModuleName } from "./module" ;
4
+ safelyRemoveCache ( getModuleName ( module ) ) ;
3
5
export default API . mockModule ;
You can’t perform that action at this time.
0 commit comments