Skip to content

Commit 1757250

Browse files
aduh95targos
authored andcommitted
test: clearing require cache crashes esm loader
This test shows the regression introduced in v11.4.0: clearing out the require.cache crashes node when using the `--experimental-modules` flag. Refs: #25482 PR-URL: #25491 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 89fda94 commit 1757250

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Flags: --experimental-modules
2+
'use strict';
3+
require('../common');
4+
5+
const { cache } = require;
6+
7+
Object.keys(cache).forEach((key) => {
8+
delete cache[key];
9+
});
10+
// Require the same module again triggers the crash
11+
require('../common');

0 commit comments

Comments
 (0)