• 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  // Busy loop to allow the work thread to abort.
12  while (true) {}
13}
14
15const p = child_process.spawnSync(
16  process.execPath, [ __filename, 'child' ]);
17assert.ifError(p.error);
18assert.ok(p.stderr.toString().includes(
19  'FATAL ERROR: work_thread foobar'));
20assert.ok(p.status === 134 || p.signal === 'SIGABRT');
21