current commit
260301.2 · test: remove unnecessary `process.exit` calls from test files
// Flags: --permission --allow-worker --allow-fs-read=*
'use strict';

const common = require('../common');
const assert = require('assert');
const { isMainThread, Worker } = require('worker_threads');

if (!isMainThread) {
  return;
}

// Guarantee the initial state
{
  assert.ok(process.permission.has('worker'));
}

// When a permission is set by cli, the process shouldn't be able
// to spawn unless --allow-worker is sent
{
  // doesNotThrow
  new Worker(__filename).on('exit', common.mustCall((code) => assert.strictEqual(code, 0)));
}