Skip to content

feat: add Bun runtime support (bun test, bun run, bunx) #832

Closed

Description

@pszymkowiak

Context

Bun is a fast JavaScript runtime used as the default in many modern projects. RTK has no support for it — no Rust module, no TOML filter, no rewrite rule.

RTK already supports Node.js ecosystem tools (npm, pnpm, vitest, tsc, eslint, prettier, next, playwright, prisma) but the Bun equivalents are missing.

Scope

Command Description Expected savings
rtk bun test Bun's built-in test runner (similar to vitest) 85-90%
rtk bun run <script> Script runner (similar to npm run) 70-80%
rtk bun install Package install (similar to pnpm install) 80-90%
rtk bunx <pkg> Package executor (similar to npx) 70-80%
rtk bun build Bundler output 75-85%

Rewrite rules

The hook should rewrite:

  • bun test → rtk bun test
  • bun run <script> → rtk bun run <script>
  • bun install → rtk bun install
  • bunx <pkg> → rtk bunx <pkg>
  • bun build → rtk bun build

Implementation

Options:

  1. Rust module (src/bun_cmd.rs) with sub-enum — best for bun test (structured output parsing)
  2. TOML filters for simpler commands (bun install, bun build)
  3. Hybrid — Rust for test, TOML for the rest

References

  • Vitest module (similar test runner): src/vitest_cmd.rs
  • pnpm module (similar package manager): src/pnpm_cmd.rs
  • npm module: src/npm_cmd.rs

Activity

  1. harmeshgv commented on Mar 25, 2026

    @harmeshgv

    Hi @pszymkowiak, I’d like to work on this feature. I have experience working with Node.js tooling and some familiarity with Bun as well. I can implement the Bun command support, including rewrite rules and required modules. Let me know if I can take this up.

  2. pszymkowiak commented on Mar 26, 2026

    @pszymkowiak
    CollaboratorAuthor

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 97%

    Summary

    Feature request to add Bun runtime support (bun test/run/install/build, bunx); partially addressed by PR #1128 — monitor PR progress before merging or closing.

    📁 Relevant files
    • src/bun_cmd.rs
    • src/vitest_cmd.rs
    • src/pnpm_cmd.rs
    • src/npm_cmd.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. XtheWiz commented on Apr 19, 2026

    @XtheWiz

    Production validation from a Bun + Elysia.js monorepo

    Adding real numbers to validate demand. From rtk discover (30-day scan, 13,730 Bash calls):

    Command Monthly runs Example
    bun test 64 bun test 2>&1

    Our bun test output is identical in structure to vitest — TAP-style pass/fail lines with a summary footer. The rtk vitest filtering logic should port directly.

    What we'd want

    rtk bun test

    • Failures-only mode (mirror rtk jest / rtk vitest): suppress passing test lines, keep errors + stack traces
    • Summary: N tests passed, M failed, K skipped
    • Exit code pass-through so CI sees the real result

    Rewrite rule needed

    Hook should rewrite bun test → rtk bun test (currently falls through as unhandled).

    Stack context

    Bun 1.2.19 + Elysia.js + Prisma monorepo. We run bun test for API integration tests every session. Currently 100% of that output lands unfiltered in context.

  4. HenriqueSchroeder commented on Apr 22, 2026

    @HenriqueSchroeder
    Contributor
  5. KuSh commented on Sep 5, 2026

    @KuSh
    Collaborator

    Bun support landed in #988 and is on develop. rtk bun test, rtk bun run, rtk bun install, rtk bun build and rtk bunx all exist, and the hook rewrites the corresponding raw commands. Verified against a real bun test run: only failures plus the summary are kept, passing lines are dropped. Please reopen or comment if you still see unfiltered Bun output on the latest version.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions