Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
--arg ccache '(import <nixpkgs> {}).sccache' \
--arg devTools '[]' \
--arg benchmarkTools '[]' \
${{ endsWith(matrix.system, '-darwin') && '--arg extraConfigFlags ''["--without-inspector"]'' \' || '\' }}
${{ endsWith(matrix.system, '-darwin') && '--arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
--run '
make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
'
2 changes: 1 addition & 1 deletion test/embedding/test-embedding.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ for (const extraSnapshotArgs of [
}

// Guarantee NODE_REPL_EXTERNAL_MODULE won't bypass kDisableNodeOptionsEnv
{
if (!process.config.variables.node_without_node_options) {
spawnSyncAndExit(
binary,
['require("os")'],
Expand Down
3 changes: 2 additions & 1 deletion test/es-module/test-esm-import-flag.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const cjsImport = fixtures.fileURL('es-modules', 'cjs-file.cjs');
const mjsEntry = fixtures.path('es-modules', 'mjs-file.mjs');
const mjsImport = fixtures.fileURL('es-modules', 'mjs-file.mjs');

const onlyIfNodeOptionsSupport = { skip: process.config.variables.node_without_node_options };

describe('import modules using --import', { concurrency: !process.env.TEST_PARALLEL }, () => {
it('should import when using --eval', async () => {
Expand Down Expand Up @@ -199,7 +200,7 @@ describe('import modules using --import', { concurrency: !process.env.TEST_PARAL
assert.strictEqual(signal, null);
});

it('should import files from the env before ones from the CLI', async () => {
it('should import files from the env before ones from the CLI', onlyIfNodeOptionsSupport, async () => {
const { code, signal, stderr, stdout } = await spawnPromisified(
execPath,
[
Expand Down
4 changes: 4 additions & 0 deletions test/es-module/test-esm-symlink-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const assert = require('assert');
const exec = require('child_process').execFile;
const fs = require('fs');

if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const tmpDir = tmpdir.path;
Expand Down
4 changes: 4 additions & 0 deletions test/es-module/test-esm-type-field-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const assert = require('assert');
const exec = require('child_process').execFile;
const { describe, it } = require('node:test');

if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

const mjsFile = require.resolve('../fixtures/es-modules/mjs-file.mjs');
const cjsFile = require.resolve('../fixtures/es-modules/cjs-file.cjs');
const packageWithoutTypeMain =
Expand Down
10 changes: 6 additions & 4 deletions test/parallel/test-cli-options-as-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const fixtureFile = fixtures.path(path.join('options-as-flags', 'fixture.cjs'));
const configFile = fixtures.path(path.join('options-as-flags', 'test-config.json'));
const envFile = fixtures.path(path.join('options-as-flags', '.test.env'));

const onlyIfNodeOptionsSupport = { skip: process.config.variables.node_without_node_options };

describe('getOptionsAsFlagsFromBinding', () => {
it('should extract flags from command line arguments', async () => {
const result = await spawnPromisified(process.execPath, [
Expand All @@ -28,7 +30,7 @@ describe('getOptionsAsFlagsFromBinding', () => {
assert.strictEqual(flags.includes('--stack-trace-limit=512'), true);
});

it('should extract flags from NODE_OPTIONS environment variable', async () => {
it('should extract flags from NODE_OPTIONS environment variable', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--expose-internals',
Expand All @@ -49,7 +51,7 @@ describe('getOptionsAsFlagsFromBinding', () => {
assert.strictEqual(flags.includes('--no-warnings'), true);
});

it('should extract flags from config file', async () => {
it('should extract flags from config file', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--expose-internals',
Expand All @@ -69,7 +71,7 @@ describe('getOptionsAsFlagsFromBinding', () => {
assert.strictEqual(flags.includes('--no-warnings'), true);
});

it('should extract flags from config file and command line', async () => {
it('should extract flags from config file and command line', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--expose-internals',
Expand All @@ -92,7 +94,7 @@ describe('getOptionsAsFlagsFromBinding', () => {
assert.strictEqual(flags.includes('--test-isolation=none'), true);
});

it('should extract flags from .env file', async () => {
it('should extract flags from .env file', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--expose-internals',
Expand Down
29 changes: 18 additions & 11 deletions test/parallel/test-config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ const { test, it, describe } = require('node:test');
const { chmodSync, writeFileSync, constants } = require('node:fs');
const { join } = require('node:path');

const onlyIfNodeOptionsSupport = { skip: process.config.variables.node_without_node_options };
const onlyWithAmaro = { skip: !process.config.variables.node_use_amaro };
const onlyWithAmaroAndNodeOptions = {
skip: !process.config.variables.node_use_amaro || process.config.variables.node_without_node_options,
};
const onlyWithInspectorAndNodeOptions = {
skip: !process.features.inspector || process.config.variables.node_without_node_options,
};

test('should handle non existing json', async () => {
const result = await spawnPromisified(process.execPath, [
Expand Down Expand Up @@ -51,7 +58,7 @@ test('should handle empty object json', async () => {
assert.strictEqual(result.code, 0);
});

test('should parse boolean flag', onlyWithAmaro, async () => {
test('should parse boolean flag', onlyWithAmaroAndNodeOptions, async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-config-file',
fixtures.path('rc/transform-types.json'),
Expand All @@ -62,7 +69,7 @@ test('should parse boolean flag', onlyWithAmaro, async () => {
assert.strictEqual(result.code, 0);
});

test('should parse boolean flag defaulted to true', async () => {
test('should parse boolean flag defaulted to true', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-config-file',
fixtures.path('rc/warnings-false.json'),
Expand All @@ -85,7 +92,7 @@ test('should throw an error when a flag is declared twice', async () => {
assert.strictEqual(result.code, 9);
});

test('should override env-file', onlyWithAmaro, async () => {
test('should override env-file', onlyWithAmaroAndNodeOptions, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-config-file',
Expand Down Expand Up @@ -128,7 +135,7 @@ test('should not override CLI flags', onlyWithAmaro, async () => {
assert.strictEqual(result.code, 1);
});

test('should parse array flag correctly', async () => {
test('should parse array flag correctly', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-config-file',
Expand All @@ -152,7 +159,7 @@ test('should validate invalid array flag', async () => {
assert.strictEqual(result.code, 9);
});

test('should validate array flag as string', async () => {
test('should validate array flag as string', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-config-file',
Expand Down Expand Up @@ -188,7 +195,7 @@ test('should throw at flag not available in NODE_OPTIONS', async () => {
assert.strictEqual(result.code, 9);
});

test('unsigned flag should be parsed correctly', async () => {
test('unsigned flag should be parsed correctly', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-config-file',
Expand Down Expand Up @@ -225,7 +232,7 @@ test('v8 flag should not be allowed in config file', async () => {
assert.strictEqual(result.code, 9);
});

test('string flag should be parsed correctly', async () => {
test('string flag should be parsed correctly', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--test',
Expand All @@ -238,7 +245,7 @@ test('string flag should be parsed correctly', async () => {
assert.strictEqual(result.code, 0);
});

test('host port flag should be parsed correctly', { skip: !process.features.inspector }, async () => {
test('host port flag should be parsed correctly', onlyWithInspectorAndNodeOptions, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--expose-internals',
Expand All @@ -251,7 +258,7 @@ test('host port flag should be parsed correctly', { skip: !process.features.insp
assert.strictEqual(result.code, 0);
});

test('--inspect=true should be parsed correctly', { skip: !process.features.inspector }, async () => {
test('--inspect=true should be parsed correctly', onlyWithInspectorAndNodeOptions, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-config-file',
Expand Down Expand Up @@ -351,7 +358,7 @@ test('broken value in node_options', async () => {
assert.strictEqual(result.code, 9);
});

test('should use node.config.json as default', async () => {
test('should use node.config.json as default', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-default-config-file',
Expand All @@ -364,7 +371,7 @@ test('should use node.config.json as default', async () => {
assert.strictEqual(result.code, 0);
});

test('should override node.config.json when specificied', async () => {
test('should override node.config.json when specificied', onlyIfNodeOptionsSupport, async () => {
const result = await spawnPromisified(process.execPath, [
'--no-warnings',
'--experimental-default-config-file',
Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-max-old-space-size-percentage.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ invalidPercentages.forEach((input) => {
assert.match(result.stderr.toString(), input[1]);
});

if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

// Test NODE_OPTIONS with valid percentages
validPercentages.forEach((input) => {
const result = spawnSync(process.execPath, [], {
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-permission-allow-child-process-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const { isMainThread } = require('worker_threads');
if (!isMainThread) {
common.skip('This test only works on a main thread');
}
if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

const assert = require('assert');
const childProcess = require('child_process');
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-permission-child-process-inherit-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const { isMainThread } = require('worker_threads');
if (!isMainThread) {
common.skip('This test only works on a main thread');
}
if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

const assert = require('assert');
const childProcess = require('child_process');
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-process-warnings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const dep1Message = /\(node:\d+\) \[DEP1\] DeprecationWarning/;
const dep2Message = /\(node:\d+\) \[DEP2\] DeprecationWarning/;
const experimentalWarningMessage = /\(node:\d+\) ExperimentalWarning/;

const onlyIfNodeOptionsSupport = { skip: process.config.variables.node_without_node_options };

describe('process warnings', { concurrency: !process.env.TEST_PARALLEL }, () => {

it('should emit all warnings by default', async () => {
Expand Down Expand Up @@ -142,7 +144,7 @@ describe('process warnings', { concurrency: !process.env.TEST_PARALLEL }, () =>
assert.strictEqual(signal, null);
});

it('should be specifiable in NODE_OPTIONS', async () => {
it('should be specifiable in NODE_OPTIONS', onlyIfNodeOptionsSupport, async () => {
const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [
fixturePath,
], {
Expand Down
6 changes: 5 additions & 1 deletion test/parallel/test-unicode-node-options.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
'use strict';
// Flags: --expose-internals
require('../common');
const common = require('../common');
const { getOptionValue } = require('internal/options');
const assert = require('assert');
const cp = require('child_process');

if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

const expected_redirect_value = 'foó';

if (process.argv.length === 2) {
Expand Down
6 changes: 5 additions & 1 deletion test/parallel/test-worker-execargv-invalid.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use strict';

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

if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

{
const expectedErr = {
code: 'ERR_INVALID_ARG_TYPE',
Expand Down
7 changes: 6 additions & 1 deletion test/parallel/test-worker-node-options.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
'use strict';

require('../common');
const common = require('../common');
const {
spawnSyncAndExitWithoutError,
spawnSyncAndAssert,
} = require('../common/child_process');

if (process.config.variables.node_without_node_options) {
common.skip('missing NODE_OPTIONS support');
}

const fixtures = require('../common/fixtures');
spawnSyncAndExitWithoutError(
process.execPath,
Expand Down
Loading