mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
When no async loader hooks are registered, perform the linking as synchronously as possible to reduce the chance of races from the the shared module loading cache. PR-URL: https://github.com/nodejs/node/pull/59519 Fixes: https://github.com/nodejs/node/issues/59366 Refs: https://github.com/abejfehr/node-22.18-issue-repro Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
29 lines
574 B
JavaScript
29 lines
574 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const file = '../fixtures/syntax/bad_syntax.mjs';
|
|
|
|
let error;
|
|
(async () => {
|
|
try {
|
|
await import(file);
|
|
} catch (e) {
|
|
assert.strictEqual(e.name, 'SyntaxError');
|
|
error = e;
|
|
}
|
|
|
|
assert(error);
|
|
|
|
await assert.rejects(
|
|
() => import(file),
|
|
(e) => {
|
|
// The module may be compiled again and a new SyntaxError would be thrown but
|
|
// with the same content.
|
|
assert.deepStrictEqual(error, e);
|
|
return true;
|
|
}
|
|
);
|
|
})().then(common.mustCall());
|