0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00
nodejs/test/parallel/test-worker-abort-on-uncaught-exception.js
Anna Henningsen fd038a1f15 worker: fix --abort-on-uncaught-exception handling
The `set_abort_on_uncaught_exception(false)` line was supposed to
prevent aborting when running Workers in
`--abort-on-uncaught-exception` mode, but it was incorrectly set
and not checked properly in the should-abort callback.

PR-URL: https://github.com/nodejs/node/pull/34724
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
2020-08-11 14:58:50 -07:00

13 lines
410 B
JavaScript

// Flags: --abort-on-uncaught-exception
'use strict';
const common = require('../common');
const assert = require('assert');
const { Worker } = require('worker_threads');
// Tests that --abort-on-uncaught-exception does not apply to
// Workers.
const w = new Worker('throw new Error()', { eval: true });
w.on('error', common.mustCall());
w.on('exit', common.mustCall((code) => assert.strictEqual(code, 1)));