mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
PR-URL: https://github.com/nodejs/node/pull/21350 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
29 lines
459 B
JavaScript
29 lines
459 B
JavaScript
'use strict';
|
|
|
|
// Flags: --experimental-modules
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
common.crashOnUnhandledRejection();
|
|
|
|
const file = '../fixtures/syntax/bad_syntax.js';
|
|
|
|
let error;
|
|
(async () => {
|
|
try {
|
|
await import(file);
|
|
} catch (e) {
|
|
assert.strictEqual(e.name, 'SyntaxError');
|
|
error = e;
|
|
}
|
|
|
|
assert(error);
|
|
|
|
try {
|
|
await import(file);
|
|
} catch (e) {
|
|
assert.strictEqual(error, e);
|
|
}
|
|
})();
|