mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
2c4ebe0426
This makes sure that all async functions finish as expected. PR-URL: https://github.com/nodejs/node/pull/34363 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
27 lines
454 B
JavaScript
27 lines
454 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) => {
|
|
assert.strictEqual(error, e);
|
|
return true;
|
|
}
|
|
);
|
|
})().then(common.mustCall());
|