Skip to content

fix(cli): run a Bun repository's test script with bun run test - #199

Closed
FredApps wants to merge 2 commits into
DiffCI:mainfrom
FredApps:fix/bun-full-command
Closed

FredApps wants to merge 2 commits into
DiffCI:mainfrom
FredApps:fix/bun-full-command

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #189

Changed behavior

inferFullCommand now returns bun run test for a Bun repository, whether Bun is chosen from packageManager or from a bun.lock/bun.lockb lockfile. bun test starts Bun's built-in test runner and ignores scripts.test; bun run test runs the script, which is what the full command is meant to be.

normalizeTestCommand in workflow-guard.ts no longer treats bun test as the same command as npm test. Only the npm, pnpm and Yarn spellings, which all run the test script, are treated as equivalent.

Validation

Merge order with #293: both edit the package-manager block of inferFullCommand (#293 moves it under an else), so whichever lands second needs main merged in; I will do that when the first lands. The resolution is #293's else structure with #199's bun run test lines; I checked it in a local merge of all our open PRs.

@FredApps

Copy link
Copy Markdown
Contributor Author

Cross-review (FredApps, head 6511637). Not an approval.

Checked

Fixed: 6511637

  • With this change, the enforce audit stopped counting a workflow step bun test as the full suite even when scripts.test is exactly bun test. That is the most common Bun setup, and those steps run the same suite.
  • auditEnforceWorkflows now also accepts bun test when the full command is bun run test and the script is exactly bun test. A script with arguments (e.g. bun test --coverage) still doesn't match.
  • Added a regression test that fails without the fix.

Open

FredApps added a commit to FredApps/core that referenced this pull request Nov 18, 2026
…ffCI#199

The manifest is an unordered set, and the PRs listed above add their entries at the same line. Moving this entry one line away lets them merge in either order without a conflict.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:56
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
* test(cli): build dist-client once instead of in every test file

Fixes #192

Signed-off-by: FredApps <[email protected]>

* chore: move the release-files.json entry so it merges cleanly with #199

The manifest is an unordered set, and the PRs listed above add their entries at the same line. Moving this entry one line away lets them merge in either order without a conflict.

Signed-off-by: FredApps <[email protected]>

---------

Signed-off-by: FredApps <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

Thanks. This one fails on Windows: both new tests in packages/diffci-cli/tests/client/bun-full-command.test.ts get .github\workflows\ci.yml#test back instead of .github/workflows/ci.yml#test:

✖ the enforce audit does not count `bun test` as a Bun repository's test script
✖ the enforce audit counts `bun test` when the test script is exactly `bun test`
  + '.github\workflows\ci.yml#test'
  - '.github/workflows/ci.yml#test'

The backslash comes from existing code: workflow-guard.ts builds ${relativePath}#${jobId} from path.relative. These are just the first tests that compare that id as a string, and the PR's CI only runs on Linux. Could you fix it? Making the job id use forward slashes would be best, since it's shown to users and compared across machines; normalising in the test would also do.

Also a heads-up: #293 changes the same block of full-command.ts. When both land, the result should be #293's else structure with this PR's bun run test lines inside it. I tested that combination and it passed.

adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
bun test is Bun's own test runner and ignores scripts.test, so a Bun
repository's full command skipped the package's real tests. It is now
bun run test, and the workflow audit treats bun test as the same only
when scripts.test is exactly bun test. Fixes #189.

Signed-off-by: FredApps <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

Merged to main as edc6a88 (squashed, authorship kept). I resolved the conflict with #293 by keeping its else branch and applying your two Bun changes inside it. The test paths now use join(".github", "workflows", "ci.yml"), so they pass on Windows. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants