node/test/message/async_error_eval_esm.js
Antoine du Hamel ac66a99cf1
test: add trailing commas in test/message
PR-URL: https://github.com/nodejs/node/pull/46372
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-01-29 19:15:22 +01:00

42 lines
627 B
JavaScript

'use strict';
require('../common');
const { spawnSync } = require('child_process');
const four = require('../common/fixtures')
.readSync('async-error.js')
.toString()
.split('\n')
.slice(2, -2)
.join('\n');
const main = `${four}
async function main() {
try {
await four();
} catch (e) {
console.log(e);
}
}
main();
`;
// --eval ESM
{
const child = spawnSync(process.execPath, [
'--input-type',
'module',
'-e',
main,
], {
env: { ...process.env },
});
if (child.status !== 0) {
console.error(child.stderr.toString());
}
console.error(child.stdout.toString());
}