@@ -13,7 +13,14 @@ const { test, it, describe } = require('node:test');
1313const { chmodSync, writeFileSync, constants } = require('node:fs');
1414const { join } = require('node:path');
1515
16+ const onlyIfNodeOptionsSupport = { skip: process.config.variables.node_without_node_options };
1617const onlyWithAmaro = { skip: !process.config.variables.node_use_amaro };
18+ const onlyWithAmaroAndNodeOptions = {
19+ skip: !process.config.variables.node_use_amaro || process.config.variables.node_without_node_options,
20+ };
21+ const onlyWithInspectorAndNodeOptions = {
22+ skip: !process.features.inspector || process.config.variables.node_without_node_options,
23+ };
1724
1825test('should handle non existing json', async () => {
1926 const result = await spawnPromisified(process.execPath, [
@@ -51,7 +58,7 @@ test('should handle empty object json', async () => {
5158 assert.strictEqual(result.code, 0);
5259});
5360
54- test('should parse boolean flag', onlyWithAmaro , async () => {
61+ test('should parse boolean flag', onlyWithAmaroAndNodeOptions , async () => {
5562 const result = await spawnPromisified(process.execPath, [
5663 '--experimental-config-file',
5764 fixtures.path('rc/transform-types.json'),
@@ -62,7 +69,7 @@ test('should parse boolean flag', onlyWithAmaro, async () => {
6269 assert.strictEqual(result.code, 0);
6370});
6471
65- test('should parse boolean flag defaulted to true', async () => {
72+ test('should parse boolean flag defaulted to true', onlyIfNodeOptionsSupport, async () => {
6673 const result = await spawnPromisified(process.execPath, [
6774 '--experimental-config-file',
6875 fixtures.path('rc/warnings-false.json'),
@@ -85,7 +92,7 @@ test('should throw an error when a flag is declared twice', async () => {
8592 assert.strictEqual(result.code, 9);
8693});
8794
88- test('should override env-file', onlyWithAmaro , async () => {
95+ test('should override env-file', onlyWithAmaroAndNodeOptions , async () => {
8996 const result = await spawnPromisified(process.execPath, [
9097 '--no-warnings',
9198 '--experimental-config-file',
@@ -128,7 +135,7 @@ test('should not override CLI flags', onlyWithAmaro, async () => {
128135 assert.strictEqual(result.code, 1);
129136});
130137
131- test('should parse array flag correctly', async () => {
138+ test('should parse array flag correctly', onlyIfNodeOptionsSupport, async () => {
132139 const result = await spawnPromisified(process.execPath, [
133140 '--no-warnings',
134141 '--experimental-config-file',
@@ -152,7 +159,7 @@ test('should validate invalid array flag', async () => {
152159 assert.strictEqual(result.code, 9);
153160});
154161
155- test('should validate array flag as string', async () => {
162+ test('should validate array flag as string', onlyIfNodeOptionsSupport, async () => {
156163 const result = await spawnPromisified(process.execPath, [
157164 '--no-warnings',
158165 '--experimental-config-file',
@@ -188,7 +195,7 @@ test('should throw at flag not available in NODE_OPTIONS', async () => {
188195 assert.strictEqual(result.code, 9);
189196});
190197
191- test('unsigned flag should be parsed correctly', async () => {
198+ test('unsigned flag should be parsed correctly', onlyIfNodeOptionsSupport, async () => {
192199 const result = await spawnPromisified(process.execPath, [
193200 '--no-warnings',
194201 '--experimental-config-file',
@@ -225,7 +232,7 @@ test('v8 flag should not be allowed in config file', async () => {
225232 assert.strictEqual(result.code, 9);
226233});
227234
228- test('string flag should be parsed correctly', async () => {
235+ test('string flag should be parsed correctly', onlyIfNodeOptionsSupport, async () => {
229236 const result = await spawnPromisified(process.execPath, [
230237 '--no-warnings',
231238 '--test',
@@ -238,7 +245,7 @@ test('string flag should be parsed correctly', async () => {
238245 assert.strictEqual(result.code, 0);
239246});
240247
241- test('host port flag should be parsed correctly', { skip: !process.features.inspector } , async () => {
248+ test('host port flag should be parsed correctly', onlyWithInspectorAndNodeOptions , async () => {
242249 const result = await spawnPromisified(process.execPath, [
243250 '--no-warnings',
244251 '--expose-internals',
@@ -251,7 +258,7 @@ test('host port flag should be parsed correctly', { skip: !process.features.insp
251258 assert.strictEqual(result.code, 0);
252259});
253260
254- test('--inspect=true should be parsed correctly', { skip: !process.features.inspector } , async () => {
261+ test('--inspect=true should be parsed correctly', onlyWithInspectorAndNodeOptions , async () => {
255262 const result = await spawnPromisified(process.execPath, [
256263 '--no-warnings',
257264 '--experimental-config-file',
@@ -351,7 +358,7 @@ test('broken value in node_options', async () => {
351358 assert.strictEqual(result.code, 9);
352359});
353360
354- test('should use node.config.json as default', async () => {
361+ test('should use node.config.json as default', onlyIfNodeOptionsSupport, async () => {
355362 const result = await spawnPromisified(process.execPath, [
356363 '--no-warnings',
357364 '--experimental-default-config-file',
@@ -364,7 +371,7 @@ test('should use node.config.json as default', async () => {
364371 assert.strictEqual(result.code, 0);
365372});
366373
367- test('should override node.config.json when specificied', async () => {
374+ test('should override node.config.json when specificied', onlyIfNodeOptionsSupport, async () => {
368375 const result = await spawnPromisified(process.execPath, [
369376 '--no-warnings',
370377 '--experimental-default-config-file',
0 commit comments