node/test/parallel/test-permission-allow-worker-cli.js
Antoine du Hamel 634dc26605
test: ensure assertions are reached on all tests
PR-URL: https://github.com/nodejs/node/pull/60845
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-11-27 09:35:25 +00:00

23 lines
552 B
JavaScript

// 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) {
process.exit(0);
}
// 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)));
}