diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 48271e2e71a80e..878814354cd667 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -288,6 +288,13 @@ class Test extends AsyncResource { }; this.waitingOn = 0; this.finished = false; + + if (!testOnlyFlag && (only || this.runOnlySubtests)) { + const warning = + "'only' does not work when node is started" + + ' without the --test-only command-line option'; + this.diagnostic(warning); + } } hasConcurrency() { diff --git a/test/message/test_runner_output.out b/test/message/test_runner_output.out index 15d2009816a961..50ac523d4afd06 100644 --- a/test/message/test_runner_output.out +++ b/test/message/test_runner_output.out @@ -475,11 +475,13 @@ ok 52 - callback async throw after done --- duration_ms: * ... + # 'only' does not work when node is started without the --test-only command-line option # Subtest: running subtest 3 ok 3 - running subtest 3 --- duration_ms: * ... + # 'only' does not work when node is started without the --test-only command-line option # Subtest: running subtest 4 ok 4 - running subtest 4 --- @@ -490,6 +492,7 @@ ok 53 - only is set but not in only mode --- duration_ms: * ... +# 'only' does not work when node is started without the --test-only command-line option # Subtest: custom inspect symbol fail not ok 54 - custom inspect symbol fail --- diff --git a/test/message/test_runner_output_cli.out b/test/message/test_runner_output_cli.out index cc9c07f4c5c409..ed2e24f8134b50 100644 --- a/test/message/test_runner_output_cli.out +++ b/test/message/test_runner_output_cli.out @@ -476,11 +476,13 @@ TAP version 13 --- duration_ms: * ... + # 'only' does not work when node is started without the --test-only command-line option # Subtest: running subtest 3 ok 3 - running subtest 3 --- duration_ms: * ... + # 'only' does not work when node is started without the --test-only command-line option # Subtest: running subtest 4 ok 4 - running subtest 4 --- @@ -491,6 +493,7 @@ TAP version 13 --- duration_ms: * ... + # 'only' does not work when node is started without the --test-only command-line option # Subtest: custom inspect symbol fail not ok 54 - custom inspect symbol fail --- diff --git a/test/message/test_runner_output_spec_reporter.out b/test/message/test_runner_output_spec_reporter.out index cf47c7ac7e33ff..79300ff857d9ef 100644 --- a/test/message/test_runner_output_spec_reporter.out +++ b/test/message/test_runner_output_spec_reporter.out @@ -199,9 +199,12 @@ only is set but not in only mode running subtest 1 (*ms) running subtest 2 (*ms) + 'only' does not work when node is started without the --test-only command-line option running subtest 3 (*ms) + 'only' does not work when node is started without the --test-only command-line option running subtest 4 (*ms) only is set but not in only mode (*ms) + 'only' does not work when node is started without the --test-only command-line option custom inspect symbol fail (*ms) customized