mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 07:51:12 +00:00

- Improve the error message that shows up when there is a race from doing require(esm) and import(esm) at the same time. - Improve error message of ERR_REQUIRE_ASYNC_MODULE by showing parent and target file names, if available. Drive-by: split the require(tla) tests since we are modifying the tests already. PR-URL: https://github.com/nodejs/node/pull/57126 Refs: https://github.com/fisker/prettier-issue-17139 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
16 lines
434 B
JavaScript
16 lines
434 B
JavaScript
'use strict';
|
|
|
|
// Tests that require(esm) throws for top-level-await in inner graphs.
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
assert.throws(() => {
|
|
require('../fixtures/es-modules/tla/parent.mjs');
|
|
}, (err) => {
|
|
common.expectRequiredTLAError(err);
|
|
assert.match(err.message, /From .*test-require-module-tla-nested\.js/);
|
|
assert.match(err.message, /Requiring .*parent\.mjs/);
|
|
return true;
|
|
});
|