File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -74,21 +74,25 @@ describe('toFile', () => {
74
74
} ) ;
75
75
76
76
describe ( 'missing File error message' , ( ) => {
77
- let prevFile : unknown ;
77
+ let prevGlobalFile : unknown ;
78
+ let prevNodeFile : unknown ;
78
79
beforeEach ( ( ) => {
79
80
// The file shim captures the global File object when it's first imported.
80
81
// Reset modules before each test so we can test the error thrown when it's undefined.
81
82
jest . resetModules ( ) ;
83
+ const buffer = require ( 'node:buffer' ) ;
82
84
// @ts -ignore
83
- prevFile = globalThis . File ;
85
+ prevGlobalFile = globalThis . File ;
86
+ prevNodeFile = buffer . File ;
84
87
// @ts -ignore
85
88
globalThis . File = undefined ;
86
- require ( 'node: buffer' ) . File = undefined ;
89
+ buffer . File = undefined ;
87
90
} ) ;
88
91
afterEach ( ( ) => {
89
92
// Clean up
90
93
// @ts -ignore
91
- globalThis . File = prevFile ;
94
+ globalThis . File = prevGlobalFile ;
95
+ require ( 'node:buffer' ) . File = prevNodeFile ;
92
96
jest . resetModules ( ) ;
93
97
} ) ;
94
98
You can’t perform that action at this time.
0 commit comments