summaryrefslogtreecommitdiff
path: root/test/message/async_error_eval_esm.js
blob: 0c9b7378d54729eae4920090a645d991a52aa39b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'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());
}