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: nodejs/node#25482

PR-URL: nodejs/node#25491
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
aduh95 committed May 25, 2019
1 parent ef51e92 commit 6de1849
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 6de1849

Please sign in to comment.