diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js index 958ad1e060fbbe..946e1a6c3ec824 100644 --- a/lib/internal/test_runner/runner.js +++ b/lib/internal/test_runner/runner.js @@ -107,7 +107,6 @@ const kFilterArgs = [ const kFilterArgValues = [ '--test-reporter', '--test-reporter-destination', - '--experimental-config-file', ]; const kDiagnosticsFilterArgs = ['tests', 'suites', 'pass', 'fail', 'cancelled', 'skipped', 'todo', 'duration_ms']; diff --git a/lib/internal/test_runner/utils.js b/lib/internal/test_runner/utils.js index 44789451d18335..d4ee43179ff299 100644 --- a/lib/internal/test_runner/utils.js +++ b/lib/internal/test_runner/utils.js @@ -196,7 +196,8 @@ function parseCommandLine() { } const isTestRunner = getOptionValue('--test'); - const coverage = getOptionValue('--experimental-test-coverage'); + const coverage = getOptionValue('--experimental-test-coverage') && + !process.env.NODE_TEST_CONTEXT; const forceExit = getOptionValue('--test-force-exit'); const sourceMaps = getOptionValue('--enable-source-maps'); const updateSnapshots = getOptionValue('--test-update-snapshots'); diff --git a/test/fixtures/test-runner/options-propagation/experimental-config-file.test.mjs b/test/fixtures/test-runner/options-propagation/experimental-config-file.test.mjs index aa36ec2b52d53b..9debfa301e9972 100644 --- a/test/fixtures/test-runner/options-propagation/experimental-config-file.test.mjs +++ b/test/fixtures/test-runner/options-propagation/experimental-config-file.test.mjs @@ -2,7 +2,7 @@ import { test } from 'node:test'; import { strictEqual } from 'node:assert'; import internal from 'internal/options'; -test('it should not receive --experimental-config-file option', () => { +test('it should receive --experimental-config-file option', () => { const optionValue = internal.getOptionValue("--experimental-config-file"); - strictEqual(optionValue, ''); + strictEqual(optionValue, 'node.config.json'); }) diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index 287e97861c9285..fbb2951724d711 100644 --- a/test/parallel/test-runner-cli.js +++ b/test/parallel/test-runner-cli.js @@ -431,7 +431,7 @@ for (const isolation of ['none', 'process']) { } { - // Should not propagate --experimental-config-file option to sub test in isolation process + // Should propagate --experimental-config-file option to sub test in isolation process const fixturePath = join(testFixtures, 'options-propagation'); const args = [ '--test-reporter=tap',