Skip to content

CLI: a Bun repository's full command is bun test, which skips the package.json test script #189

Closed

Description

@FredApps

What went wrong?

The output or a command was wrong: DiffCI runs the wrong full-suite command for Bun repositories.

DiffCI version

0.3.54 (main at 40aa308)

Command you ran

diffci check, diffci coverage and diffci verify-workflow --enforce in a repository with bun.lock (or bun.lockb, or "packageManager": "bun@...").

Environment

Ubuntu, Node.js 24.22.1, Bun 1.x, terminal.

What happens

inferFullCommand (packages/diffci-cli/src/client/full-command.ts) returns bun test as the full command for a Bun repository, with the reason "package.json test script with Bun lockfile" (or "via bun").

bun test is not the package.json test script. It starts Bun's built-in test runner, which discovers *.test.* and *.spec.* files by itself and never reads scripts.test. bun run test runs the script. npm, pnpm and Yarn behave differently: for them <manager> test does run the script.

Minimal reproduction:

mkdir bun-repro && cd bun-repro
echo '{"name":"p","private":true,"scripts":{"test":"node --test t/"}}' > package.json
mkdir t
echo 'import test from "node:test"; test("from the script", () => {});' > t/a.test.mjs
echo 'import { test, expect } from "bun:test"; test("bun only", () => expect(1).toBe(2));' > t/b.test.ts
touch bun.lock
bun test       # runs Bun's runner over both files; t/b.test.ts fails; scripts.test is ignored
bun run test   # runs `node --test t/`, the repository's real test command

So for a Bun repository whose script runs Vitest, Jest or node --test, the full-suite timing in check, the command coverage runs by default, and the full-suite fallback all run a different suite than CI does.

The enforce audit has the same assumption: normalizeTestCommand in src/client/workflow-guard.ts treats bun run test and bun test as the same command, so a workflow that only runs bun test is accepted as running the full suite on the default branch.

What you expected

The full command for a Bun repository is bun run test, and bun test is not treated as equivalent to it.

Regression test

packages/diffci-cli/tests/client/bun-full-command.test.ts in the linked pull request fails on main and passes with the fix.

Activity

  1. added a commit that references this issue on Nov 18, 2026
    edc6a88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions