0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 03:07:54 +01:00
nodejs/test/abort/test-worker-abort-uncaught-exception.js
Michaël Zasso 82b44f465b
test: adapt abort tests for new Windows code
V8 9.1 changed the way it aborts on uncaught exceptions on Windows.
It now uses the code 0x80000003 (exception breakpoint) instead of
0xC0000005 (access violation).

Refs: 26d85acee2

PR-URL: https://github.com/nodejs/node/pull/38273
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
2021-06-10 11:11:54 +02:00

25 lines
691 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { spawn } = require('child_process');
const { Worker } = require('worker_threads');
// Tests that --abort-on-uncaught-exception applies to workers as well.
if (process.argv[2] === 'child') {
new Worker('throw new Error("foo");', { eval: true });
return;
}
const child = spawn(process.execPath, [
'--abort-on-uncaught-exception', __filename, 'child',
]);
child.on('exit', common.mustCall((code, sig) => {
if (common.isWindows) {
assert.strictEqual(code, 0x80000003);
} else {
assert(['SIGABRT', 'SIGTRAP', 'SIGILL'].includes(sig),
`Unexpected signal ${sig}`);
}
}));