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: https://github.com/nodejs/node/issues/25482 PR-URL: https://github.com/nodejs/node/pull/25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
6fe369286a
commit
ac3b98cd26
11
test/es-module/test-esm-loader-cache-clearing.js
Normal file
11
test/es-module/test-esm-loader-cache-clearing.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Flags: --experimental-modules
|
||||||
|
'use strict';
|
||||||
|
require('../common');
|
||||||
|
|
||||||
|
const { cache } = require;
|
||||||
|
|
||||||
|
Object.keys(cache).forEach((key) => {
|
||||||
|
delete cache[key];
|
||||||
|
});
|
||||||
|
// Require the same module again triggers the crash
|
||||||
|
require('../common');
|
Loading…
x
Reference in New Issue
Block a user