summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/bootstrap/loaders.js3
-rw-r--r--lib/internal/bootstrap/node.js50
-rw-r--r--lib/internal/modules/cjs/helpers.js (renamed from lib/internal/module.js)0
-rw-r--r--lib/internal/modules/cjs/loader.js (renamed from lib/module.js)27
-rw-r--r--lib/internal/modules/esm/CreateDynamicModule.js (renamed from lib/internal/loader/CreateDynamicModule.js)0
-rw-r--r--lib/internal/modules/esm/DefaultResolve.js (renamed from lib/internal/loader/DefaultResolve.js)2
-rw-r--r--lib/internal/modules/esm/Loader.js (renamed from lib/internal/loader/Loader.js)10
-rw-r--r--lib/internal/modules/esm/ModuleJob.js (renamed from lib/internal/loader/ModuleJob.js)0
-rw-r--r--lib/internal/modules/esm/ModuleMap.js (renamed from lib/internal/loader/ModuleMap.js)2
-rw-r--r--lib/internal/modules/esm/Translators.js (renamed from lib/internal/loader/Translators.js)13
-rw-r--r--lib/internal/process/esm_loader.js (renamed from lib/internal/process/modules.js)2
-rw-r--r--lib/repl.js23
-rw-r--r--node.gyp17
-rw-r--r--test/es-module/test-esm-loader-modulemap.js8
-rw-r--r--test/es-module/test-esm-loader-search.js2
-rw-r--r--test/fixtures/module-require-depth/one.js10
-rw-r--r--test/fixtures/module-require-depth/two.js10
-rw-r--r--test/message/core_line_numbers.out12
-rw-r--r--test/message/error_exit.out12
-rw-r--r--test/message/esm_display_syntax_error.out2
-rw-r--r--test/message/esm_display_syntax_error_import.out2
-rw-r--r--test/message/esm_display_syntax_error_import_module.out2
-rw-r--r--test/message/esm_display_syntax_error_module.out2
-rw-r--r--test/message/eval_messages.out8
-rw-r--r--test/message/events_unhandled_error_common_trace.out14
-rw-r--r--test/message/events_unhandled_error_nexttick.out14
-rw-r--r--test/message/events_unhandled_error_sameline.out14
-rw-r--r--test/message/if-error-has-good-stack.out12
-rw-r--r--test/message/nexttick_throw.out2
-rw-r--r--test/message/stdin_messages.out8
-rw-r--r--test/message/undefined_reference_in_new_context.out10
-rw-r--r--test/message/vm_display_runtime_error.out24
-rw-r--r--test/message/vm_display_syntax_error.out24
-rw-r--r--test/message/vm_dont_display_runtime_error.out12
-rw-r--r--test/message/vm_dont_display_syntax_error.out12
-rw-r--r--test/parallel/test-internal-module-map-asserts.js2
-rw-r--r--test/parallel/test-internal-modules-strip-shebang.js2
-rw-r--r--test/parallel/test-module-require-depth.js8
38 files changed, 203 insertions, 174 deletions
diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js
index 601c54a0cd..f7384b2784 100644
--- a/lib/internal/bootstrap/loaders.js
+++ b/lib/internal/bootstrap/loaders.js
@@ -1,6 +1,7 @@
// This file creates the internal module & binding loaders used by built-in
// modules. In contrast, user land modules are loaded using
-// lib/module.js (CommonJS Modules) or lib/internal/loader/* (ES Modules).
+// lib/internal/modules/cjs/loader.js (CommonJS Modules) or
+// lib/internal/modules/esm/* (ES Modules).
//
// This file is compiled and run by node.cc before bootstrap/node.js
// was called, therefore the loaders are bootstraped before we start to
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 67ec63eb01..7d7ca03d36 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -112,7 +112,7 @@
process.emitWarning(
'The ESM module loader is experimental.',
'ExperimentalWarning', undefined);
- NativeModule.require('internal/process/modules').setup();
+ NativeModule.require('internal/process/esm_loader').setup();
}
{
@@ -194,8 +194,10 @@
preloadModules();
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
- const internalModule = NativeModule.require('internal/module');
- internalModule.addBuiltinLibsToObject(global);
+ const {
+ addBuiltinLibsToObject
+ } = NativeModule.require('internal/modules/cjs/helpers');
+ addBuiltinLibsToObject(global);
evalScript('[eval]');
} else if (process.argv[1] && process.argv[1] !== '-') {
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
@@ -203,13 +205,13 @@
const path = NativeModule.require('path');
process.argv[1] = path.resolve(process.argv[1]);
- const Module = NativeModule.require('module');
+ const CJSModule = NativeModule.require('internal/modules/cjs/loader');
// check if user passed `-c` or `--check` arguments to Node.
if (process._syntax_check_only != null) {
const fs = NativeModule.require('fs');
// read the source
- const filename = Module._resolveFilename(process.argv[1]);
+ const filename = CJSModule._resolveFilename(process.argv[1]);
const source = fs.readFileSync(filename, 'utf-8');
checkScriptSyntax(source, filename);
process.exit(0);
@@ -220,7 +222,7 @@
preloadModules();
perf.markMilestone(
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END);
- Module.runMain();
+ CJSModule.runMain();
} else {
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START);
perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END);
@@ -345,7 +347,7 @@
function setupGlobalConsole() {
const originalConsole = global.console;
- const Module = NativeModule.require('module');
+ const CJSModule = NativeModule.require('internal/modules/cjs/loader');
// Setup Node.js global.console
const wrappedConsole = NativeModule.require('console');
Object.defineProperty(global, 'console', {
@@ -353,7 +355,7 @@
enumerable: false,
value: wrappedConsole
});
- setupInspector(originalConsole, wrappedConsole, Module);
+ setupInspector(originalConsole, wrappedConsole, CJSModule);
}
function setupGlobalURL() {
@@ -374,19 +376,20 @@
});
}
- function setupInspector(originalConsole, wrappedConsole, Module) {
+ function setupInspector(originalConsole, wrappedConsole, CJSModule) {
if (!process.config.variables.v8_enable_inspector) {
return;
}
const { addCommandLineAPI, consoleCall } = process.binding('inspector');
// Setup inspector command line API
- const { makeRequireFunction } = NativeModule.require('internal/module');
+ const { makeRequireFunction } =
+ NativeModule.require('internal/modules/cjs/helpers');
const path = NativeModule.require('path');
const cwd = tryGetCwd(path);
- const consoleAPIModule = new Module('<inspector console>');
+ const consoleAPIModule = new CJSModule('<inspector console>');
consoleAPIModule.paths =
- Module._nodeModulePaths(cwd).concat(Module.globalPaths);
+ CJSModule._nodeModulePaths(cwd).concat(CJSModule.globalPaths);
addCommandLineAPI('require', makeRequireFunction(consoleAPIModule));
const config = {};
for (const key of Object.keys(wrappedConsole)) {
@@ -515,13 +518,13 @@
}
function evalScript(name) {
- const Module = NativeModule.require('module');
+ const CJSModule = NativeModule.require('internal/modules/cjs/loader');
const path = NativeModule.require('path');
const cwd = tryGetCwd(path);
- const module = new Module(name);
+ const module = new CJSModule(name);
module.filename = path.join(cwd, name);
- module.paths = Module._nodeModulePaths(cwd);
+ module.paths = CJSModule._nodeModulePaths(cwd);
const body = wrapForBreakOnFirstLine(process._eval);
const script = `global.__filename = ${JSON.stringify(name)};\n` +
'global.exports = exports;\n' +
@@ -540,21 +543,26 @@
// Load preload modules
function preloadModules() {
if (process._preload_modules) {
- NativeModule.require('module')._preloadModules(process._preload_modules);
+ const {
+ _preloadModules
+ } = NativeModule.require('internal/modules/cjs/loader');
+ _preloadModules(process._preload_modules);
}
}
function checkScriptSyntax(source, filename) {
- const Module = NativeModule.require('module');
+ const CJSModule = NativeModule.require('internal/modules/cjs/loader');
const vm = NativeModule.require('vm');
- const internalModule = NativeModule.require('internal/module');
+ const {
+ stripShebang, stripBOM
+ } = NativeModule.require('internal/modules/cjs/helpers');
// remove Shebang
- source = internalModule.stripShebang(source);
+ source = stripShebang(source);
// remove BOM
- source = internalModule.stripBOM(source);
+ source = stripBOM(source);
// wrap it
- source = Module.wrap(source);
+ source = CJSModule.wrap(source);
// compile the script, this will throw if it fails
new vm.Script(source, { displayErrors: true, filename });
}
diff --git a/lib/internal/module.js b/lib/internal/modules/cjs/helpers.js
index 61565cc593..61565cc593 100644
--- a/lib/internal/module.js
+++ b/lib/internal/modules/cjs/helpers.js
diff --git a/lib/module.js b/lib/internal/modules/cjs/loader.js
index 0b94cb84c6..a172266661 100644
--- a/lib/module.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -35,7 +35,12 @@ const {
internalModuleStat
} = process.binding('fs');
const { safeGetenv } = process.binding('util');
-const internalModule = require('internal/module');
+const {
+ makeRequireFunction,
+ requireDepth,
+ stripBOM,
+ stripShebang
+} = require('internal/modules/cjs/helpers');
const preserveSymlinks = !!process.binding('config').preserveSymlinks;
const experimentalModules = !!process.binding('config').experimentalModules;
@@ -48,9 +53,9 @@ const {
module.exports = Module;
// these are below module.exports for the circular reference
-const internalESModule = require('internal/process/modules');
-const ModuleJob = require('internal/loader/ModuleJob');
-const createDynamicModule = require('internal/loader/CreateDynamicModule');
+const asyncESM = require('internal/process/esm_loader');
+const ModuleJob = require('internal/modules/esm/ModuleJob');
+const createDynamicModule = require('internal/modules/esm/CreateDynamicModule');
const {
CHAR_UPPERCASE_A,
CHAR_LOWERCASE_A,
@@ -477,7 +482,7 @@ Module._load = function(request, parent, isMain) {
}
if (experimentalModules && isMain) {
- internalESModule.loaderPromise.then((loader) => {
+ asyncESM.loaderPromise.then((loader) => {
return loader.import(getURLFromFilePath(request).pathname);
})
.catch((e) => {
@@ -583,7 +588,7 @@ Module.prototype.load = function(filename) {
this.loaded = true;
if (experimentalModules) {
- const ESMLoader = internalESModule.ESMLoader;
+ const ESMLoader = asyncESM.ESMLoader;
const url = getURLFromFilePath(filename);
const urlString = `${url}`;
const exports = this.exports;
@@ -631,7 +636,7 @@ var resolvedArgv;
// Returns exception, if any.
Module.prototype._compile = function(content, filename) {
- content = internalModule.stripShebang(content);
+ content = stripShebang(content);
// create wrapper function
var wrapper = Module.wrap(content);
@@ -660,8 +665,8 @@ Module.prototype._compile = function(content, filename) {
}
}
var dirname = path.dirname(filename);
- var require = internalModule.makeRequireFunction(this);
- var depth = internalModule.requireDepth;
+ var require = makeRequireFunction(this);
+ var depth = requireDepth;
if (depth === 0) stat.cache = new Map();
var result;
if (inspectorWrapper) {
@@ -679,7 +684,7 @@ Module.prototype._compile = function(content, filename) {
// Native extension for .js
Module._extensions['.js'] = function(module, filename) {
var content = fs.readFileSync(filename, 'utf8');
- module._compile(internalModule.stripBOM(content), filename);
+ module._compile(stripBOM(content), filename);
};
@@ -687,7 +692,7 @@ Module._extensions['.js'] = function(module, filename) {
Module._extensions['.json'] = function(module, filename) {
var content = fs.readFileSync(filename, 'utf8');
try {
- module.exports = JSON.parse(internalModule.stripBOM(content));
+ module.exports = JSON.parse(stripBOM(content));
} catch (err) {
err.message = filename + ': ' + err.message;
throw err;
diff --git a/lib/internal/loader/CreateDynamicModule.js b/lib/internal/modules/esm/CreateDynamicModule.js
index 7e9777af51..7e9777af51 100644
--- a/lib/internal/loader/CreateDynamicModule.js
+++ b/lib/internal/modules/esm/CreateDynamicModule.js
diff --git a/lib/internal/loader/DefaultResolve.js b/lib/internal/modules/esm/DefaultResolve.js
index a012314d2a..00461e7df1 100644
--- a/lib/internal/loader/DefaultResolve.js
+++ b/lib/internal/modules/esm/DefaultResolve.js
@@ -1,7 +1,7 @@
'use strict';
const { URL } = require('url');
-const CJSmodule = require('module');
+const CJSmodule = require('internal/modules/cjs/loader');
const internalFS = require('internal/fs');
const { NativeModule, internalBinding } = require('internal/bootstrap/loaders');
const { extname } = require('path');
diff --git a/lib/internal/loader/Loader.js b/lib/internal/modules/esm/Loader.js
index e4457cfd81..84c23cc10a 100644
--- a/lib/internal/loader/Loader.js
+++ b/lib/internal/modules/esm/Loader.js
@@ -6,11 +6,11 @@ const {
ERR_MISSING_DYNAMIC_INTSTANTIATE_HOOK,
ERR_UNKNOWN_MODULE_FORMAT
} = require('internal/errors').codes;
-const ModuleMap = require('internal/loader/ModuleMap');
-const ModuleJob = require('internal/loader/ModuleJob');
-const defaultResolve = require('internal/loader/DefaultResolve');
-const createDynamicModule = require('internal/loader/CreateDynamicModule');
-const translators = require('internal/loader/Translators');
+const ModuleMap = require('internal/modules/esm/ModuleMap');
+const ModuleJob = require('internal/modules/esm/ModuleJob');
+const defaultResolve = require('internal/modules/esm/DefaultResolve');
+const createDynamicModule = require('internal/modules/esm/CreateDynamicModule');
+const translators = require('internal/modules/esm/Translators');
const FunctionBind = Function.call.bind(Function.prototype.bind);
diff --git a/lib/internal/loader/ModuleJob.js b/lib/internal/modules/esm/ModuleJob.js
index d948252829..d948252829 100644
--- a/lib/internal/loader/ModuleJob.js
+++ b/lib/internal/modules/esm/ModuleJob.js
diff --git a/lib/internal/loader/ModuleMap.js b/lib/internal/modules/esm/ModuleMap.js
index dce8f834ba..e9a8d22d7b 100644
--- a/lib/internal/loader/ModuleMap.js
+++ b/lib/internal/modules/esm/ModuleMap.js
@@ -1,6 +1,6 @@
'use strict';
-const ModuleJob = require('internal/loader/ModuleJob');
+const ModuleJob = require('internal/modules/esm/ModuleJob');
const { SafeMap } = require('internal/safe_globals');
const debug = require('util').debuglog('esm');
const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;
diff --git a/lib/internal/loader/Translators.js b/lib/internal/modules/esm/Translators.js
index 8796b4ddfd..2928115be5 100644
--- a/lib/internal/loader/Translators.js
+++ b/lib/internal/modules/esm/Translators.js
@@ -2,10 +2,13 @@
const { NativeModule, internalBinding } = require('internal/bootstrap/loaders');
const { ModuleWrap } = internalBinding('module_wrap');
-const internalCJSModule = require('internal/module');
-const CJSModule = require('module');
+const {
+ stripShebang,
+ stripBOM
+} = require('internal/modules/cjs/helpers');
+const CJSModule = require('internal/modules/cjs/loader');
const internalURLModule = require('internal/url');
-const createDynamicModule = require('internal/loader/CreateDynamicModule');
+const createDynamicModule = require('internal/modules/esm/CreateDynamicModule');
const fs = require('fs');
const { _makeLong } = require('path');
const { SafeMap } = require('internal/safe_globals');
@@ -24,7 +27,7 @@ translators.set('esm', async (url) => {
const source = `${await readFileAsync(new URL(url))}`;
debug(`Translating StandardModule ${url}`);
return {
- module: new ModuleWrap(internalCJSModule.stripShebang(source), url),
+ module: new ModuleWrap(stripShebang(source), url),
reflect: undefined
};
});
@@ -82,7 +85,7 @@ translators.set('json', async (url) => {
const pathname = internalURLModule.getPathFromURL(new URL(url));
const content = readFileSync(pathname, 'utf8');
try {
- const exports = JsonParse(internalCJSModule.stripBOM(content));
+ const exports = JsonParse(stripBOM(content));
reflect.exports.default.set(exports);
} catch (err) {
err.message = pathname + ': ' + err.message;
diff --git a/lib/internal/process/modules.js b/lib/internal/process/esm_loader.js
index ca2a9dde5d..e45c0faa18 100644
--- a/lib/internal/process/modules.js
+++ b/lib/internal/process/esm_loader.js
@@ -7,7 +7,7 @@ const {
} = internalBinding('module_wrap');
const { getURLFromFilePath } = require('internal/url');
-const Loader = require('internal/loader/Loader');
+const Loader = require('internal/modules/esm/Loader');
const path = require('path');
const { URL } = require('url');
diff --git a/lib/repl.js b/lib/repl.js
index 078bb208ae..06703da131 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -42,7 +42,11 @@
'use strict';
-const internalModule = require('internal/module');
+const {
+ builtinLibs,
+ makeRequireFunction,
+ addBuiltinLibsToObject
+} = require('internal/modules/cjs/helpers');
const { processTopLevelAwait } = require('internal/repl/await');
const internalUtil = require('internal/util');
const { isTypedArray } = require('internal/util/types');
@@ -55,7 +59,7 @@ const path = require('path');
const fs = require('fs');
const { Interface } = require('readline');
const { Console } = require('console');
-const Module = require('module');
+const CJSModule = require('internal/modules/cjs/loader');
const domain = require('domain');
const debug = util.debuglog('repl');
const {
@@ -96,7 +100,7 @@ try {
}
// Hack for repl require to work properly with node_modules folders
-module.paths = Module._nodeModulePaths(module.filename);
+module.paths = CJSModule._nodeModulePaths(module.filename);
// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
@@ -112,7 +116,7 @@ writer.options = Object.assign({},
util.inspect.defaultOptions,
{ showProxy: true, depth: 2 });
-exports._builtinLibs = internalModule.builtinLibs;
+exports._builtinLibs = builtinLibs;
function REPLServer(prompt,
stream,
@@ -789,14 +793,15 @@ REPLServer.prototype.createContext = function() {
}
}
- var module = new Module('<repl>');
- module.paths = Module._resolveLookupPaths('<repl>', parentModule, true) || [];
+ var module = new CJSModule('<repl>');
+ module.paths =
+ CJSModule._resolveLookupPaths('<repl>', parentModule, true) || [];
- var require = internalModule.makeRequireFunction(module);
+ var require = makeRequireFunction(module);
context.module = module;
context.require = require;
- internalModule.addBuiltinLibsToObject(context);
+ addBuiltinLibsToObject(context);
return context;
};
@@ -1005,7 +1010,7 @@ function complete(line, callback) {
} else if (/^\.\.?\//.test(completeOn)) {
paths = [process.cwd()];
} else {
- paths = module.paths.concat(Module.globalPaths);
+ paths = module.paths.concat(CJSModule.globalPaths);
}
for (i = 0; i < paths.length; i++) {
diff --git a/node.gyp b/node.gyp
index 06f0a3b57c..91d57631d6 100644
--- a/node.gyp
+++ b/node.gyp
@@ -104,17 +104,18 @@
'lib/internal/http.js',
'lib/internal/inspector_async_hook.js',
'lib/internal/linkedlist.js',
- 'lib/internal/loader/Loader.js',
- 'lib/internal/loader/CreateDynamicModule.js',
- 'lib/internal/loader/DefaultResolve.js',
- 'lib/internal/loader/ModuleJob.js',
- 'lib/internal/loader/ModuleMap.js',
- 'lib/internal/loader/Translators.js',
+ 'lib/internal/modules/cjs/helpers.js',
+ 'lib/internal/modules/cjs/loader.js',
+ 'lib/internal/modules/esm/Loader.js',
+ 'lib/internal/modules/esm/CreateDynamicModule.js',
+ 'lib/internal/modules/esm/DefaultResolve.js',
+ 'lib/internal/modules/esm/ModuleJob.js',
+ 'lib/internal/modules/esm/ModuleMap.js',
+ 'lib/internal/modules/esm/Translators.js',
'lib/internal/safe_globals.js',
'lib/internal/net.js',
- 'lib/internal/module.js',
'lib/internal/os.js',
- 'lib/internal/process/modules.js',
+ 'lib/internal/process/esm_loader.js',
'lib/internal/process/next_tick.js',
'lib/internal/process/promises.js',
'lib/internal/process/stdio.js',
diff --git a/test/es-module/test-esm-loader-modulemap.js b/test/es-module/test-esm-loader-modulemap.js
index 1c1623b680..e9faa6d9f1 100644
--- a/test/es-module/test-esm-loader-modulemap.js
+++ b/test/es-module/test-esm-loader-modulemap.js
@@ -7,10 +7,10 @@
const common = require('../common');
const { URL } = require('url');
-const Loader = require('internal/loader/Loader');
-const ModuleMap = require('internal/loader/ModuleMap');
-const ModuleJob = require('internal/loader/ModuleJob');
-const createDynamicModule = require('internal/loader/CreateDynamicModule');
+const Loader = require('internal/modules/esm/Loader');
+const ModuleMap = require('internal/modules/esm/ModuleMap');
+const ModuleJob = require('internal/modules/esm/ModuleJob');
+const createDynamicModule = require('internal/modules/esm/CreateDynamicModule');
const stubModuleUrl = new URL('file://tmp/test');
const stubModule = createDynamicModule(['default'], stubModuleUrl);
diff --git a/test/es-module/test-esm-loader-search.js b/test/es-module/test-esm-loader-search.js
index 4a85ea9325..0f4591a4e3 100644
--- a/test/es-module/test-esm-loader-search.js
+++ b/test/es-module/test-esm-loader-search.js
@@ -5,7 +5,7 @@
const common = require('../common');
-const { search } = require('internal/loader/DefaultResolve');
+const { search } = require('internal/modules/esm/DefaultResolve');
common.expectsError(
() => search('target', undefined),
diff --git a/test/fixtures/module-require-depth/one.js b/test/fixtures/module-require-depth/one.js
index 5927908b75..02b451465b 100644
--- a/test/fixtures/module-require-depth/one.js
+++ b/test/fixtures/module-require-depth/one.js
@@ -1,9 +1,11 @@
// Flags: --expose_internals
'use strict';
const assert = require('assert');
-const internalModule = require('internal/module');
+const {
+ requireDepth
+} = require('internal/modules/cjs/helpers');
-exports.requireDepth = internalModule.requireDepth;
-assert.strictEqual(internalModule.requireDepth, 1);
+exports.requireDepth = requireDepth;
+assert.strictEqual(requireDepth, 1);
assert.deepStrictEqual(require('./two'), { requireDepth: 2 });
-assert.strictEqual(internalModule.requireDepth, 1);
+assert.strictEqual(requireDepth, 1);
diff --git a/test/fixtures/module-require-depth/two.js b/test/fixtures/module-require-depth/two.js
index aea49947d1..5c94c4c89a 100644
--- a/test/fixtures/module-require-depth/two.js
+++ b/test/fixtures/module-require-depth/two.js
@@ -1,9 +1,11 @@
// Flags: --expose_internals
'use strict';
const assert = require('assert');
-const internalModule = require('internal/module');
+const {
+ requireDepth
+} = require('internal/modules/cjs/helpers');
-exports.requireDepth = internalModule.requireDepth;
-assert.strictEqual(internalModule.requireDepth, 2);
+exports.requireDepth = requireDepth;
+assert.strictEqual(requireDepth, 2);
assert.deepStrictEqual(require('./one'), { requireDepth: 1 });
-assert.strictEqual(internalModule.requireDepth, 2);
+assert.strictEqual(requireDepth, 2);
diff --git a/test/message/core_line_numbers.out b/test/message/core_line_numbers.out
index 5658a5a59e..b50e1678f4 100644
--- a/test/message/core_line_numbers.out
+++ b/test/message/core_line_numbers.out
@@ -6,10 +6,10 @@ RangeError: Invalid input
at error (punycode.js:42:*)
at Object.decode (punycode.js:*:*)
at Object.<anonymous> (*test*message*core_line_numbers.js:*:*)
- at Module._compile (module.js:*:*)
- at Object.Module._extensions..js (module.js:*:*)
- at Module.load (module.js:*:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
+ at Module.load (internal/modules/cjs/loader.js:*:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
diff --git a/test/message/error_exit.out b/test/message/error_exit.out
index 2cbc4ad4fd..e7bcb05065 100644
--- a/test/message/error_exit.out
+++ b/test/message/error_exit.out
@@ -5,11 +5,11 @@ assert.js:*
AssertionError [ERR_ASSERTION]: 1 strictEqual 2
at Object.<anonymous> (*test*message*error_exit.js:*:*)
- at Module._compile (module.js:*:*)
- at Object.Module._extensions..js (module.js:*:*)
- at Module.load (module.js:*:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
+ at Module.load (internal/modules/cjs/loader.js:*:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
diff --git a/test/message/esm_display_syntax_error.out b/test/message/esm_display_syntax_error.out
index 57d39e6c79..4564fe06d5 100644
--- a/test/message/esm_display_syntax_error.out
+++ b/test/message/esm_display_syntax_error.out
@@ -3,4 +3,4 @@ file:///*/test/message/esm_display_syntax_error.mjs:3
await async () => 0;
^^^^^
SyntaxError: Unexpected reserved word
- at translators.set (internal/loader/Translators.js:*:*)
+ at translators.set (internal/modules/esm/Translators.js:*:*)
diff --git a/test/message/esm_display_syntax_error_import.out b/test/message/esm_display_syntax_error_import.out
index 617ecd09ef..02050d361e 100644
--- a/test/message/esm_display_syntax_error_import.out
+++ b/test/message/esm_display_syntax_error_import.out
@@ -3,4 +3,4 @@ file:///*/test/message/esm_display_syntax_error_import.mjs:6
notfound
^^^^^^^^
SyntaxError: The requested module '../fixtures/es-module-loaders/module-named-exports' does not provide an export named 'notfound'
- at ModuleJob._instantiate (internal/loader/ModuleJob.js:*:*)
+ at ModuleJob._instantiate (internal/modules/esm/ModuleJob.js:*:*)
diff --git a/test/message/esm_display_syntax_error_import_module.out b/test/message/esm_display_syntax_error_import_module.out
index 2e7ea8e572..ae0bf331de 100644
--- a/test/message/esm_display_syntax_error_import_module.out
+++ b/test/message/esm_display_syntax_error_import_module.out
@@ -3,4 +3,4 @@ file:///*/test/fixtures/es-module-loaders/syntax-error-import.mjs:1
import { foo, notfound } from './module-named-exports';
^^^^^^^^
SyntaxError: The requested module './module-named-exports' does not provide an export named 'notfound'
- at ModuleJob._instantiate (internal/loader/ModuleJob.js:*:*)
+ at ModuleJob._instantiate (internal/modules/esm/ModuleJob.js:*:*)
diff --git a/test/message/esm_display_syntax_error_module.out b/test/message/esm_display_syntax_error_module.out
index 56bbac9307..fc0581c225 100644
--- a/test/message/esm_display_syntax_error_module.out
+++ b/test/message/esm_display_syntax_error_module.out
@@ -3,4 +3,4 @@ file:///*/test/fixtures/es-module-loaders/syntax-error.mjs:2
await async () => 0;
^^^^^
SyntaxError: Unexpected reserved word
- at translators.set (internal/loader/Translators.js:*:*)
+ at translators.set (internal/modules/esm/Translators.js:*:*)
diff --git a/test/message/eval_messages.out b/test/message/eval_messages.out
index 84772ffa48..d01dfe547c 100644
--- a/test/message/eval_messages.out
+++ b/test/message/eval_messages.out
@@ -7,7 +7,7 @@ SyntaxError: Strict mode code may not include a with statement
at createScript (vm.js:*:*)
at Object.runInThisContext (vm.js:*:*)
at Object.<anonymous> ([eval]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
@@ -22,7 +22,7 @@ Error: hello
at Script.runInThisContext (vm.js:*:*)
at Object.runInThisContext (vm.js:*:*)
at Object.<anonymous> ([eval]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
@@ -36,7 +36,7 @@ Error: hello
at Script.runInThisContext (vm.js:*:*)
at Object.runInThisContext (vm.js:*:*)
at Object.<anonymous> ([eval]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
@@ -50,7 +50,7 @@ ReferenceError: y is not defined
at Script.runInThisContext (vm.js:*:*)
at Object.runInThisContext (vm.js:*:*)
at Object.<anonymous> ([eval]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
diff --git a/test/message/events_unhandled_error_common_trace.out b/test/message/events_unhandled_error_common_trace.out
index 003446edaa..f6b74e9991 100644
--- a/test/message/events_unhandled_error_common_trace.out
+++ b/test/message/events_unhandled_error_common_trace.out
@@ -6,17 +6,17 @@ Error: foo:bar
at bar (*events_unhandled_error_common_trace.js:*:*)
at foo (*events_unhandled_error_common_trace.js:*:*)
at Object.<anonymous> (*events_unhandled_error_common_trace.js:*:*)
- at Module._compile (module.js:*:*)
- at Object.Module._extensions..js (module.js:*:*)
- at Module.load (module.js:*:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
+ at Module.load (internal/modules/cjs/loader.js:*:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
Emitted 'error' event at:
at quux (*events_unhandled_error_common_trace.js:*:*)
at Object.<anonymous> (*events_unhandled_error_common_trace.js:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
[... lines matching original stack trace ...]
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
diff --git a/test/message/events_unhandled_error_nexttick.out b/test/message/events_unhandled_error_nexttick.out
index 5912f9fd38..e00580ce93 100644
--- a/test/message/events_unhandled_error_nexttick.out
+++ b/test/message/events_unhandled_error_nexttick.out
@@ -4,17 +4,17 @@ events.js:*
Error
at Object.<anonymous> (*events_unhandled_error_nexttick.js:*:*)
- at Module._compile (module.js:*:*)
- at Object.Module._extensions..js (module.js:*:*)
- at Module.load (module.js:*:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
+ at Module.load (internal/modules/cjs/loader.js:*:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
Emitted 'error' event at:
at process.nextTick (*events_unhandled_error_nexttick.js:*:*)
at process._tickCallback (internal/process/next_tick.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
diff --git a/test/message/events_unhandled_error_sameline.out b/test/message/events_unhandled_error_sameline.out
index dcbb45afbd..55841cdbc3 100644
--- a/test/message/events_unhandled_error_sameline.out
+++ b/test/message/events_unhandled_error_sameline.out
@@ -4,16 +4,16 @@ events.js:*
Error
at Object.<anonymous> (*events_unhandled_error_sameline.js:*:*)
- at Module._compile (module.js:*:*)
- at Object.Module._extensions..js (module.js:*:*)
- at Module.load (module.js:*:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
+ at Module.load (internal/modules/cjs/loader.js:*:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
Emitted 'error' event at:
at Object.<anonymous> (*events_unhandled_error_sameline.js:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
diff --git a/test/message/if-error-has-good-stack.out b/test/message/if-error-has-good-stack.out
index 7aa58b0283..2a4dfe8fb2 100644
--- a/test/message/if-error-has-good-stack.out
+++ b/test/message/if-error-has-good-stack.out
@@ -11,9 +11,9 @@ AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
at b (*if-error-has-good-stack.js:*:*)
at a (*if-error-has-good-stack.js:*:*)
at Object.<anonymous> (*if-error-has-good-stack.js:*:*)
- at Module._compile (module.js:*:*)
- at Object.Module._extensions..js (module.js:*:*)
- at Module.load (module.js:*:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
+ at Module.load (internal/modules/cjs/loader.js:*:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
diff --git a/test/message/nexttick_throw.out b/test/message/nexttick_throw.out
index 798b208d7d..16e41f6343 100644
--- a/test/message/nexttick_throw.out
+++ b/test/message/nexttick_throw.out
@@ -5,6 +5,6 @@
ReferenceError: undefined_reference_error_maker is not defined
at *test*message*nexttick_throw.js:*:*
at process._tickCallback (internal/process/next_tick.js:*:*)
- at Function.Module.runMain (module.js:*:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
at startup (internal/bootstrap/node.js:*:*)
at bootstrapNodeJSCore (internal/bootstrap/node.js:*:*)
diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out
index c6c37a5be4..d4498b452a 100644
--- a/test/message/stdin_messages.out
+++ b/test/message/stdin_messages.out
@@ -7,7 +7,7 @@ SyntaxError: Strict mode code may not include a with statement
at createScript (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> ([stdin]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at Socket.<anonymous> (internal/bootstrap/node.js:*:*)
at Socket.emit (events.js:*:*)
@@ -24,7 +24,7 @@ Error: hello
at Script.runInThisContext (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> ([stdin]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at Socket.<anonymous> (internal/bootstrap/node.js:*:*)
at Socket.emit (events.js:*:*)
@@ -39,7 +39,7 @@ Error: hello
at Script.runInThisContext (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> ([stdin]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at Socket.<anonymous> (internal/bootstrap/node.js:*:*)
at Socket.emit (events.js:*:*)
@@ -55,7 +55,7 @@ ReferenceError: y is not defined
at Script.runInThisContext (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> ([stdin]-wrapper:*:*)
- at Module._compile (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*:*)
at evalScript (internal/bootstrap/node.js:*:*)
at Socket.<anonymous> (internal/bootstrap/node.js:*:*)
at Socket.emit (events.js:*:*)
diff --git a/test/message/undefined_reference_in_new_context.out b/test/message/undefined_reference_in_new_context.out
index ff517cc981..6b5fedfa99 100644
--- a/test/message/undefined_reference_in_new_context.out
+++ b/test/message/undefined_reference_in_new_context.out
@@ -9,8 +9,8 @@ ReferenceError: foo is not defined
at Script.runInNewContext (vm.js:*)
at Object.runInNewContext (vm.js:*)
at Object.<anonymous> (*test*message*undefined_reference_in_new_context.js:*)
- at Module._compile (module.js:*)
- at *..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at *..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*:*)
diff --git a/test/message/vm_display_runtime_error.out b/test/message/vm_display_runtime_error.out
index 056ea79f8d..bc95b2a7b0 100644
--- a/test/message/vm_display_runtime_error.out
+++ b/test/message/vm_display_runtime_error.out
@@ -8,12 +8,12 @@ Error: boo!
at Script.runInThisContext (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> (*test*message*vm_display_runtime_error.js:*)
- at Module._compile (module.js:*)
- at Object.Module._extensions..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*)
- at Function.Module.runMain (module.js:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*)
test.vm:1
throw new Error("spooky!")
^
@@ -23,9 +23,9 @@ Error: spooky!
at Script.runInThisContext (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> (*test*message*vm_display_runtime_error.js:*)
- at Module._compile (module.js:*)
- at Object.Module._extensions..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*)
- at Function.Module.runMain (module.js:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*)
diff --git a/test/message/vm_display_syntax_error.out b/test/message/vm_display_syntax_error.out
index f3b9953307..f0692723e8 100644
--- a/test/message/vm_display_syntax_error.out
+++ b/test/message/vm_display_syntax_error.out
@@ -7,12 +7,12 @@ SyntaxError: Unexpected number
at createScript (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> (*test*message*vm_display_syntax_error.js:*)
- at Module._compile (module.js:*)
- at Object.Module._extensions..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*)
- at Function.Module.runMain (module.js:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*)
test.vm:1
var 5;
^
@@ -21,9 +21,9 @@ SyntaxError: Unexpected number
at createScript (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> (*test*message*vm_display_syntax_error.js:*)
- at Module._compile (module.js:*)
- at Object.Module._extensions..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*)
- at Function.Module.runMain (module.js:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*)
diff --git a/test/message/vm_dont_display_runtime_error.out b/test/message/vm_dont_display_runtime_error.out
index a7e06d49f8..532cfbf4dd 100644
--- a/test/message/vm_dont_display_runtime_error.out
+++ b/test/message/vm_dont_display_runtime_error.out
@@ -9,9 +9,9 @@ Error: boo!
at Script.runInThisContext (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> (*test*message*vm_dont_display_runtime_error.js:*)
- at Module._compile (module.js:*)
- at Object.Module._extensions..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*)
- at Function.Module.runMain (module.js:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*)
diff --git a/test/message/vm_dont_display_syntax_error.out b/test/message/vm_dont_display_syntax_error.out
index 5c74c25dd8..f27cb1a085 100644
--- a/test/message/vm_dont_display_syntax_error.out
+++ b/test/message/vm_dont_display_syntax_error.out
@@ -9,9 +9,9 @@ SyntaxError: Unexpected number
at createScript (vm.js:*)
at Object.runInThisContext (vm.js:*)
at Object.<anonymous> (*test*message*vm_dont_display_syntax_error.js:*)
- at Module._compile (module.js:*)
- at Object.Module._extensions..js (module.js:*)
- at Module.load (module.js:*)
- at tryModuleLoad (module.js:*:*)
- at Function.Module._load (module.js:*)
- at Function.Module.runMain (module.js:*)
+ at Module._compile (internal/modules/cjs/loader.js:*)
+ at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
+ at Module.load (internal/modules/cjs/loader.js:*)
+ at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
+ at Function.Module._load (internal/modules/cjs/loader.js:*)
+ at Function.Module.runMain (internal/modules/cjs/loader.js:*)
diff --git a/test/parallel/test-internal-module-map-asserts.js b/test/parallel/test-internal-module-map-asserts.js
index 1160c91042..330f04cfd9 100644
--- a/test/parallel/test-internal-module-map-asserts.js
+++ b/test/parallel/test-internal-module-map-asserts.js
@@ -3,7 +3,7 @@
const common = require('../common');
const assert = require('assert');
-const ModuleMap = require('internal/loader/ModuleMap');
+const ModuleMap = require('internal/modules/esm/ModuleMap');
// ModuleMap.get, ModuleMap.has and ModuleMap.set should only accept string
// values as url argument.
diff --git a/test/parallel/test-internal-modules-strip-shebang.js b/test/parallel/test-internal-modules-strip-shebang.js
index 93be3d4198..6c23848a96 100644
--- a/test/parallel/test-internal-modules-strip-shebang.js
+++ b/test/parallel/test-internal-modules-strip-shebang.js
@@ -3,7 +3,7 @@
require('../common');
const assert = require('assert');
-const stripShebang = require('internal/module').stripShebang;
+const stripShebang = require('internal/modules/cjs/helpers').stripShebang;
[
['', ''],
diff --git a/test/parallel/test-module-require-depth.js b/test/parallel/test-module-require-depth.js
index 151934917c..0a3fc2826c 100644
--- a/test/parallel/test-module-require-depth.js
+++ b/test/parallel/test-module-require-depth.js
@@ -3,12 +3,14 @@
require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
-const internalModule = require('internal/module');
+const {
+ requireDepth
+} = require('internal/modules/cjs/helpers');
// Module one loads two too so the expected depth for two is, well, two.
-assert.strictEqual(internalModule.requireDepth, 0);
+assert.strictEqual(requireDepth, 0);
const one = require(fixtures.path('module-require-depth', 'one'));
const two = require(fixtures.path('module-require-depth', 'two'));
assert.deepStrictEqual(one, { requireDepth: 1 });
assert.deepStrictEqual(two, { requireDepth: 2 });
-assert.strictEqual(internalModule.requireDepth, 0);
+assert.strictEqual(requireDepth, 0);