Skip to content

Fix Bun test defaults#1860

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
jakeleventhal:codex/bun-test-defaults
Jul 5, 2026
Merged

Fix Bun test defaults#1860
webpro merged 1 commit into
webpro-nl:mainfrom
jakeleventhal:codex/bun-test-defaults

Conversation

@jakeleventhal

Copy link
Copy Markdown
Contributor

Summary

  • enable the Bun plugin for Bun lockfile projects as well as direct bun test scripts
  • parse bun test scripts with options before test, such as bun --config=... test
  • use Bun default test globs when the plugin is enabled without an explicit test script, so colocated *.test.ts and *.test.tsx files are treated as entries
  • ignore the package-manager bun dependency when the Bun plugin provides defaults

Validation

  • bun test test/plugins/bun.test.ts test/plugins/bun2.test.ts test/plugins/bun3.test.ts test/plugins/bun4.test.ts test/plugins/bun5.test.ts test/plugins/bun6.test.ts test/plugins/bun7.test.ts
  • pnpm build
  • pnpm test --runtime bun --smoke
  • verified against rip-technologies with its bun.entry workaround removed via a temporary config: patched Knip no longer reports colocated test files as unused, and no longer reports the root bun devDependency as unused

@pkg-pr-new

pkg-pr-new Bot commented Jul 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@1860
npm i https://pkg.pr.new/@knip/language-server@1860
npm i https://pkg.pr.new/@knip/mcp@1860

commit: 35f6e4a

@webpro

webpro commented Jul 5, 2026

Copy link
Copy Markdown
Member

Thanks Jake! I think I'm just going to merge this one and then revisit both Node.js and Bun plugins and apply a more consistent approach as each has its own pros/cons. The fixtures should prevent regressions.

@webpro
webpro merged commit 2ac4c04 into webpro-nl:main Jul 5, 2026
30 checks passed
@webpro

webpro commented Jul 5, 2026

Copy link
Copy Markdown
Member

Just pushed a bunch of refactors around this, feel free to review and/or try it out. Planning to release main tomorrow.

@webpro

webpro commented Jul 7, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.25.0. See Release 6.25.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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.

2 participants