Skip to content

Commit d319c2e

Browse files
committed
fix delete require.cache
1 parent 59e74cf commit d319c2e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/constants.test.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('constants with CHECKOUT', async function (t) {
2020

2121
return {
2222
teardown: () => {
23-
delete require.cache[`file://${require.resolve('../constants')}`]
23+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
2424
global.Pear = null
2525
}
2626
}
@@ -48,7 +48,7 @@ test('constants with default MOUNT', async function (t) {
4848

4949
return {
5050
teardown: () => {
51-
delete require.cache[`file://${require.resolve('../constants')}`]
51+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
5252
global.Pear = null
5353
}
5454
}
@@ -61,7 +61,7 @@ test('constants with default MOUNT', async function (t) {
6161
t.ok(constants.MOUNT === pathToFileURL(dirname).href)
6262
})
6363

64-
test('constants with MOUNT starting with c:', { skip: isWindows }, async function (t) {
64+
test('constants with MOUNT starting with c:', async function (t) {
6565
t.plan(1)
6666

6767
const rig = () => {
@@ -74,7 +74,7 @@ test('constants with MOUNT starting with c:', { skip: isWindows }, async functio
7474

7575
return {
7676
teardown: () => {
77-
delete require.cache[`file://${require.resolve('../constants')}`]
77+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
7878
global.Pear = null
7979
}
8080
}
@@ -84,7 +84,7 @@ test('constants with MOUNT starting with c:', { skip: isWindows }, async functio
8484
t.teardown(teardown)
8585

8686
const constants = require('../constants')
87-
t.ok(constants.MOUNT === 'file:///c:/custom/mount')
87+
t.ok(constants.MOUNT === pathToFileURL('c:/custom/mount').href)
8888
})
8989

9090
test('constants with MOUNT starting with file:', { skip: isWindows }, async function (t) {
@@ -100,7 +100,7 @@ test('constants with MOUNT starting with file:', { skip: isWindows }, async func
100100

101101
return {
102102
teardown: () => {
103-
delete require.cache[`file://${require.resolve('../constants')}`]
103+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
104104
global.Pear = null
105105
}
106106
}
@@ -126,7 +126,7 @@ test('constants with MOUNT starting with ./', { skip: isWindows }, async functio
126126

127127
return {
128128
teardown: () => {
129-
delete require.cache[`file://${require.resolve('../constants')}`]
129+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
130130
global.Pear = null
131131
}
132132
}
@@ -152,7 +152,7 @@ test('constants with MOUNT starting with ../', { skip: isWindows }, async functi
152152

153153
return {
154154
teardown: () => {
155-
delete require.cache[`file://${require.resolve('../constants')}`]
155+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
156156
global.Pear = null
157157
}
158158
}
@@ -178,7 +178,7 @@ test('constants with MOUNT starting with /', { skip: isWindows }, async function
178178

179179
return {
180180
teardown: () => {
181-
delete require.cache[`file://${require.resolve('../constants')}`]
181+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
182182
global.Pear = null
183183
}
184184
}
@@ -204,7 +204,7 @@ test('constants with MOUNT starting with pear://', { skip: isWindows }, async fu
204204

205205
return {
206206
teardown: () => {
207-
delete require.cache[`file://${require.resolve('../constants')}`]
207+
delete require.cache[pathToFileURL(require.resolve('../constants'))]
208208
global.Pear = null
209209
}
210210
}

0 commit comments

Comments
 (0)