• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../../common');
3const assert = require('assert');
4const child_process = require('child_process');
5const test_fatal = require(`./build/${common.buildType}/test_fatal`);
6
7// Test in a child process because the test code will trigger a fatal error
8// that crashes the process.
9if (process.argv[2] === 'child') {
10  test_fatal.TestThread();
11  while (true) {
12    // Busy loop to allow the work thread to abort.
13  }
14}
15
16const p = child_process.spawnSync(
17  process.execPath, [ __filename, 'child' ]);
18assert.ifError(p.error);
19assert.ok(p.stderr.toString().includes(
20  'FATAL ERROR: work_thread foobar'));
21assert.ok(p.status === 134 || p.signal === 'SIGABRT');
22