mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

PR-URL: https://github.com/nodejs/node/pull/58992 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
16 lines
410 B
JavaScript
16 lines
410 B
JavaScript
// This tests that after failing to require an ESM that throws,
|
|
// retrying with import() still rejects.
|
|
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
assert.throws(() => {
|
|
require('../fixtures/es-modules/throw-error.mjs');
|
|
}, {
|
|
message: 'test',
|
|
});
|
|
|
|
assert.rejects(import('../fixtures/es-modules/throw-error.mjs'), {
|
|
message: 'test',
|
|
}).then(common.mustCall());
|