Skip to content

Commit

Permalink
test: clearing require cache crashes esm loader
Browse files Browse the repository at this point in the history
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

Backport-PR-URL: #27874
PR-URL: #25491
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
aduh95 authored and BethGriggs committed Jun 6, 2019
1 parent 819a647 commit cc3ca08
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/es-module/test-esm-loader-cache-clearing.js
Original file line number Diff line number Diff line change
@@ -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');

0 comments on commit cc3ca08

Please sign in to comment.