1'use strict'; 2const common = require('../../common'); 3const helper = require('../../common/report.js'); 4const tmpdir = require('../../common/tmpdir'); 5 6const assert = require('assert'); 7const child_process = require('child_process'); 8const test_fatal = require(`./build/${common.buildType}/test_fatal`); 9 10if (common.buildType === 'Debug') 11 common.skip('as this will currently fail with a Debug check ' + 12 'in v8::Isolate::GetCurrent()'); 13 14// Test in a child process because the test code will trigger a fatal error 15// that crashes the process. 16if (process.argv[2] === 'child') { 17 test_fatal.TestThread(); 18 // Busy loop to allow the work thread to abort. 19 while (true) {} 20} 21 22tmpdir.refresh(); 23const p = child_process.spawnSync( 24 process.execPath, 25 [ '--report-on-fatalerror', __filename, 'child' ], 26 { cwd: tmpdir.path }); 27assert.ifError(p.error); 28assert.ok(p.stderr.toString().includes( 29 'FATAL ERROR: work_thread foobar')); 30assert.ok(p.status === 134 || p.signal === 'SIGABRT'); 31 32const reports = helper.findReports(p.pid, tmpdir.path); 33assert.strictEqual(reports.length, 1); 34 35const report = reports[0]; 36helper.validate(report); 37