From bab583497c3aefb205353a06af53906a795a07ea Mon Sep 17 00:00:00 2001 From: robobun Date: Thu, 27 Nov 2025 18:12:07 -0800 Subject: [PATCH] fix(cli): correct --dry-run help text for bun publish (#25137) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Fix `bun publish --help` showing incorrect `--dry-run` description ("Don't install anything" → "Perform a dry run without making changes") - The `--dry-run` flag is in a shared params array used by multiple commands, so the new generic message works for all of them Fixes #24806 ## Test plan - [x] Verify `bun publish --help` shows "Perform a dry run without making changes" for --dry-run - [x] Regression test added that validates the correct help text is shown - [x] Test passes with debug build, fails with system bun (validating it tests the right thing) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot Co-authored-by: Claude Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../PackageManager/CommandLineArguments.zig | 2 +- test/regression/issue/24806.test.ts | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/regression/issue/24806.test.ts diff --git a/src/install/PackageManager/CommandLineArguments.zig b/src/install/PackageManager/CommandLineArguments.zig index ea47d3c98b..6413f46349 100644 --- a/src/install/PackageManager/CommandLineArguments.zig +++ b/src/install/PackageManager/CommandLineArguments.zig @@ -27,7 +27,7 @@ const shared_params = [_]ParamType{ clap.parseParam("--save Save to package.json (true by default)") catch unreachable, clap.parseParam("--ca ... Provide a Certificate Authority signing certificate") catch unreachable, clap.parseParam("--cafile The same as `--ca`, but is a file path to the certificate") catch unreachable, - clap.parseParam("--dry-run Don't install anything") catch unreachable, + clap.parseParam("--dry-run Perform a dry run without making changes") catch unreachable, clap.parseParam("--frozen-lockfile Disallow changes to lockfile") catch unreachable, clap.parseParam("-f, --force Always request the latest versions from the registry & reinstall all dependencies") catch unreachable, clap.parseParam("--cache-dir Store & load cached data from a specific directory path") catch unreachable, diff --git a/test/regression/issue/24806.test.ts b/test/regression/issue/24806.test.ts new file mode 100644 index 0000000000..6ac23b69cf --- /dev/null +++ b/test/regression/issue/24806.test.ts @@ -0,0 +1,23 @@ +import { expect, test } from "bun:test"; +import { bunEnv, bunExe } from "harness"; + +test("bun publish --help shows correct message for --dry-run", async () => { + await using proc = Bun.spawn({ + cmd: [bunExe(), "publish", "--help"], + env: bunEnv, + stdout: "pipe", + stderr: "pipe", + }); + + const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); + + // The --dry-run flag should have a generic description that works for all commands + // It should NOT say "Don't install anything" when used with "bun publish" + expect(stdout).toContain("--dry-run"); + expect(stdout).toContain("Perform a dry run without making changes"); + + // Make sure it doesn't contain the old incorrect message + expect(stdout).not.toContain("Don't install anything"); + + expect(exitCode).toBe(0); +});