From 0d6a27d394d4265e9cb5729711813dc2867dfb32 Mon Sep 17 00:00:00 2001 From: pfg Date: Mon, 22 Sep 2025 16:07:44 -0700 Subject: [PATCH] Remove remnants of '--only' flag in documentation (#22168) --- completions/bun.zsh | 1 - docs/test/writing.md | 6 ------ packages/bun-types/test.d.ts | 2 +- src/cli/Arguments.zig | 2 -- test/cli/test/bun-test.test.ts | 10 +++++----- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/completions/bun.zsh b/completions/bun.zsh index 3680e71814..3931619ddf 100644 --- a/completions/bun.zsh +++ b/completions/bun.zsh @@ -665,7 +665,6 @@ _bun_test_completion() { '--timeout[Set the per-test timeout in milliseconds, default is 5000.]:timeout' \ '--update-snapshots[Update snapshot files]' \ '--rerun-each[Re-run each test file times, helps catch certain bugs]:rerun' \ - '--only[Only run tests that are marked with "test.only()"]' \ '--todo[Include tests that are marked with "test.todo()"]' \ '--coverage[Generate a coverage profile]' \ '--bail[Exit the test suite after failures. If you do not specify a number, it defaults to 1.]:bail' \ diff --git a/docs/test/writing.md b/docs/test/writing.md index 1f21bfaa5d..9ada86ffb6 100644 --- a/docs/test/writing.md +++ b/docs/test/writing.md @@ -149,12 +149,6 @@ describe.only("only", () => { The following command will only execute tests #2 and #3. -```sh -$ bun test --only -``` - -The following command will only execute tests #1, #2 and #3. - ```sh $ bun test ``` diff --git a/packages/bun-types/test.d.ts b/packages/bun-types/test.d.ts index 0e95ed3477..107b17f1cf 100644 --- a/packages/bun-types/test.d.ts +++ b/packages/bun-types/test.d.ts @@ -423,7 +423,7 @@ declare module "bun:test" { options?: number | TestOptions, ): void; /** - * Skips all other tests, except this test when run with the `--only` option. + * Skips all other tests, except this test. */ only: Test; /** diff --git a/src/cli/Arguments.zig b/src/cli/Arguments.zig index 7418db3ea9..8a446aa783 100644 --- a/src/cli/Arguments.zig +++ b/src/cli/Arguments.zig @@ -192,7 +192,6 @@ pub const test_only_params = [_]ParamType{ clap.parseParam("--timeout Set the per-test timeout in milliseconds, default is 5000.") catch unreachable, clap.parseParam("-u, --update-snapshots Update snapshot files") catch unreachable, clap.parseParam("--rerun-each Re-run each test file times, helps catch certain bugs") catch unreachable, - clap.parseParam("--only Only run tests that are marked with \"test.only()\"") catch unreachable, clap.parseParam("--todo Include tests that are marked with \"test.todo()\"") catch unreachable, clap.parseParam("--concurrent Treat all tests as `test.concurrent()` tests") catch unreachable, clap.parseParam("--coverage Generate a coverage profile") catch unreachable, @@ -492,7 +491,6 @@ pub fn parse(allocator: std.mem.Allocator, ctx: Command.Context, comptime cmd: C } ctx.test_options.update_snapshots = args.flag("--update-snapshots"); ctx.test_options.run_todo = args.flag("--todo"); - ctx.test_options.only = args.flag("--only"); ctx.test_options.concurrent = args.flag("--concurrent"); } diff --git a/test/cli/test/bun-test.test.ts b/test/cli/test/bun-test.test.ts index d11be02503..e26174401f 100644 --- a/test/cli/test/bun-test.test.ts +++ b/test/cli/test/bun-test.test.ts @@ -225,10 +225,10 @@ describe("bun test", () => { expect(stderr).toContain("should run"); }); }); - describe("--only", () => { - test("should run nested describe.only when enabled", () => { + describe("only", () => { + test("should run nested describe.only", () => { const stderr = runTest({ - args: ["--only"], + args: [], input: ` import { test, describe } from "bun:test"; describe("outer", () => { @@ -249,9 +249,9 @@ describe("bun test", () => { expect(stderr).not.toContain("unreachable"); expect(stderr.match(/reachable/g)).toHaveLength(1); }); - test("should skip non-only tests when enabled", () => { + test("should skip non-only tests", () => { const stderr = runTest({ - args: ["--only"], + args: [], input: ` import { test, describe } from "bun:test"; test("test #1", () => {