• 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.TestStringLength();
11  return;
12}
13
14const p = child_process.spawnSync(
15  process.execPath, [ '--napi-modules', __filename, 'child' ]);
16assert.ifError(p.error);
17assert.ok(p.stderr.toString().includes(
18  'FATAL ERROR: test_fatal::Test fatal message'));
19assert.ok(p.status === 134 || p.signal === 'SIGABRT');
20