mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
Enable running tests inside workers by passing `--worker` to `tools/test.py`. A number of tests are marked as skipped, or have been slightly altered to fit the different environment. PR-URL: https://github.com/nodejs/node/pull/20876 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (process.config.variables.node_without_node_options)
|
|
common.skip('missing NODE_OPTIONS support');
|
|
if (!common.isMainThread)
|
|
common.skip('process.chdir is not available in Workers');
|
|
|
|
// Test options specified by env variable.
|
|
|
|
const assert = require('assert');
|
|
const exec = require('child_process').execFile;
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
process.chdir(tmpdir.path);
|
|
|
|
disallow('--version');
|
|
disallow('-v');
|
|
disallow('--help');
|
|
disallow('-h');
|
|
disallow('--eval');
|
|
disallow('-e');
|
|
disallow('--print');
|
|
disallow('-p');
|
|
disallow('-pe');
|
|
disallow('--check');
|
|
disallow('-c');
|
|
disallow('--interactive');
|
|
disallow('-i');
|
|
disallow('--v8-options');
|
|
disallow('--');
|
|
disallow('--no_warnings'); // Node options don't allow '_' instead of '-'.
|
|
|
|
function disallow(opt) {
|
|
const env = Object.assign({}, process.env, { NODE_OPTIONS: opt });
|
|
exec(process.execPath, { env }, common.mustCall(function(err) {
|
|
const message = err.message.split(/\r?\n/)[1];
|
|
const expect = `${process.execPath}: ${opt} is not allowed in NODE_OPTIONS`;
|
|
|
|
assert.strictEqual(err.code, 9);
|
|
assert.strictEqual(message, expect);
|
|
}));
|
|
}
|