node/test/message/async_error_eval_cjs.js
Rich Trott 330f25ef82 test: prepare for consistent comma-dangle lint rule
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.

PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
2021-04-01 23:14:29 -07:00

40 lines
592 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 CJS
{
const child = spawnSync(process.execPath, [
'-e',
main,
], {
env: { ...process.env }
});
if (child.status !== 0) {
console.error(child.stderr.toString());
}
console.error(child.stdout.toString());
}