File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -2,5 +2,10 @@ sudo: false
2
2
language : node_js
3
3
node_js :
4
4
- stable
5
+ - ' 12.0'
6
+ - ' 11.0'
7
+ - ' 10.0'
8
+ - ' 9.0'
9
+ - ' 8.0'
5
10
- ' 5.0'
6
11
- ' 0.10'
Original file line number Diff line number Diff line change @@ -116,6 +116,15 @@ function reset () {
116
116
// Reset all changes in paths caused by addPath function
117
117
modulePaths . forEach ( function ( path ) {
118
118
removePathHelper ( path , require . main . paths )
119
+
120
+ // Delete from require.cache if the module has been required before.
121
+ // This is required for node >= 11
122
+ Object . getOwnPropertyNames ( require . cache ) . forEach ( function ( name ) {
123
+ if ( name . indexOf ( path ) !== - 1 ) {
124
+ delete require . cache [ name ]
125
+ }
126
+ } )
127
+
119
128
var parent = module . parent
120
129
while ( parent && parent !== require . main ) {
121
130
removePathHelper ( path , parent . paths )
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ describe('module-alias', function () {
107
107
expectAliasesToBeImported ( )
108
108
} )
109
109
110
- describe ( 'with process.cwd()' , function ( ) {
110
+ describe ( 'when base working directory is process.cwd()' , function ( ) {
111
111
var baseWorkingDirectory
112
112
beforeEach ( function ( ) {
113
113
baseWorkingDirectory = process . cwd ( )
@@ -125,7 +125,7 @@ describe('module-alias', function () {
125
125
} )
126
126
} )
127
127
128
- describe ( 'by looking up __dirname/../../' , function ( ) {
128
+ describe ( 'when module-alias package is nested ( looking up __dirname/../../) ' , function ( ) {
129
129
var moduleAliasDir = path . resolve (
130
130
'.' ,
131
131
'test' ,
You can’t perform that action at this time.
0 commit comments