summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-abort-on-uncaught-exception-terminate.js
blob: de73b5e4e34e47298b82c706708554205e944cf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// 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
// termination exceptions.

const w = new Worker('while(true);', { eval: true });
w.on('online', common.mustCall(() => w.terminate()));
w.on('exit', common.mustCall((code) => assert.strictEqual(code, 1)));