# Testing signals — oven-sh/bun

> Canonical page: https://codevetter.com/unpack/bun/testing-signals

# Testing signals — oven-sh/bun

Scanned commit bf80d21c69c355f6e5bae2749485674663ed13a1 (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Testing is dominated by 2,149 JS/TS test files run through Bun's own Jest-compatible runner, orchestrated by a Node.js script (`scripts/runner.node.ts`, 3,504 lines) that deliberately avoids Bun APIs and imports nothing, spawning each file in a separate process so crashes are attributable. Coverage is heaviest in `test/js` (1,307 files) and `test/regression` (426 issue-numbered files); `test/bundler` uses a dedicated `itBundled` harness, `test/bake` covers HMR, and `test/internal` tests the build scripts themselves. Rust has thin unit coverage — 76 files contain `#[test]` out of ~700 Rust source files. CI shards the suite 20 ways on Linux with ASAN options set, and non-binary lanes (types, source lints) are excluded from Buildkite and run in GitHub Actions instead.
- There are 2,149 test files under `test/`, distributed as `test/js` 1,307, `test/regression` 426, `test/cli` 202, `test/bundler` 110, `test/napi` 60, `test/internal` 57, `test/integration` 28, `test/bake` 27, and `test/v8` 1. — [test/js](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/js) [test/regression](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/regression) [test/cli](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/cli) [test/bundler](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/bundler)
- `scripts/runner.node.ts` is explicitly documented as running each `bun test` invocation in a separate process to catch crashes, as unable to use Bun APIs (it runs under Node), and as importing no dependencies so it starts fast. — [scripts/runner.node.ts#L1-10](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/scripts/runner.node.ts#L1-L10)
- `test/harness.ts` (2,367 lines) is the shared fixture layer, exporting `bunExe()`, `bunEnv`, `tempDir`/`tempDirWithFiles`, `normalizeBunSnapshot`, platform predicates (`isMacOS`, `isMusl`, `isASAN`, `isDebug`), `describeWithContainer` for Docker-backed suites, `getFDCount`, and RSS-delta assertions for leak tests. — [test/harness.ts#L18-70](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/harness.ts#L18-L70) [test/harness.ts#L346-370](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/harness.ts#L346-L370) [test/harness.ts#L1180-1200](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/harness.ts#L1180-L1200)
- Bundler tests use a purpose-built `itBundled` helper in `test/bundler/expectBundled.ts` rather than raw spawns, and the repo documents it as the required entry point for bundler/transpiler tests. — [test/bundler/expectBundled.ts#L1962](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/bundler/expectBundled.ts#L1962) [CLAUDE.md](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/CLAUDE.md)
- Regression tests are namespaced by real GitHub issue number under `test/regression/issue/`, and CLAUDE.md restricts that directory to true regressions — behavior that worked in a prior release — with everything else going into the existing module test file. — [test/regression](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/regression) [CLAUDE.md](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/CLAUDE.md)
- `test/internal/` tests the build system itself rather than the runtime — `build-rust-toolchain-probe.test.ts`, `build-post-link-ordering.test.ts`, `build-timings.test.ts`, `rust-check-all.test.ts`, `runner-junit.test.ts`, `parallel-allowlist.test.ts`. — [test/internal/build-post-link-ordering.test.ts](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/internal/build-post-link-ordering.test.ts) [test/internal/rust-check-all.test.ts](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/internal/rust-check-all.test.ts) [test/internal/runner-junit.test.ts](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/internal/runner-junit.test.ts)
- Rust unit-test coverage is sparse relative to the surface: only 76 files under `src/` contain a `#[test]` attribute and 79 contain a `#[cfg(test)]` module, against ~701 Rust source files — correctness is overwhelmingly asserted from the JS side against a built binary. (inferred) — [src](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/src) [Cargo.toml](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/Cargo.toml)
- CI test steps are sharded by platform — `parallelism` 20 on Linux, 8 on Windows, 2 on macOS, and 1 on the beta tier — with timeouts of 30/45/60 minutes and `soft_fail` only on the beta lane. — [.buildkite/ci.ts#L930-945](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/.buildkite/ci.ts#L930-L945)
- The Buildkite test step explicitly excludes `integration/bun-types` and `internal/source-lints`, delegating them to `.github/workflows/bun-types.yml` and `.github/workflows/source-lints.yml` because they never touch the built binary. — [.buildkite/ci.ts#L905-915](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/.buildkite/ci.ts#L905-L915) [.github/workflows/bun-types.yml](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/.github/workflows/bun-types.yml) [.github/workflows/source-lints.yml](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/.github/workflows/source-lints.yml)
- CI test jobs set `ASAN_OPTIONS=allow_user_segv_handler=1:disable_coredump=0:detect_leaks=0` and assert the agent's actual platform via `EXPECTED_PLATFORM_OS`/`ARCH`/`ABI`/`DISTRO`/`RELEASE` before running any test, so a mislabeled agent fails loudly instead of silently testing the wrong target. — [.buildkite/ci.ts#L940-960](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/.buildkite/ci.ts#L940-L960)
- Leak testing has dedicated infrastructure: a `testleak` npm script that enables `BUN_DESTRUCT_VM_ON_EXIT=1` with LSAN suppressions from `test/leaksan.supp`, plus in-binary suppressions compiled into `__lsan_default_suppressions` for Rust-side structural allocations. — [package.json#L60-62](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/package.json#L60-L62) [test/leaksan.supp](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/leaksan.supp) [src/runtime/bin_entry/mod.rs#L96-145](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/src/runtime/bin_entry/mod.rs#L96-L145)
- Flakiness and timing are managed as tracked data files rather than ad-hoc retries: `test/flaky-tests.txt`, `test/expected-durations.json`, `test/parallel-allowlist.json`, `test/parallel-denylist.txt`, and `test/expectations.txt`. — [test/flaky-tests.txt](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/flaky-tests.txt) [test/expected-durations.json](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/expected-durations.json) [test/parallel-allowlist.json](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/parallel-allowlist.json)
- The test workspace pulls in ~100 real npm packages (express, fastify, nest, prisma, typeorm, mongodb, socket.io, webpack, astro, svelte, verdaccio, vitest) so compatibility is asserted against actual ecosystem code rather than mocks. — [test/package.json](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/test/package.json)
- The documented verification contract for a new test is dual-run: it must fail under `USE_SYSTEM_BUN=1 bun test <file>` and pass under `bun bd test <file>`, otherwise the test is considered invalid. — [CLAUDE.md](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/CLAUDE.md) [REVIEW.md#L10-12](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/REVIEW.md#L10-L12)
- Test-failure triage is tooled: `bun run ci:errors`, `ci:status`, `ci:logs`, `ci:watch`, and `ci:slowest` wrap the BuildKite CLI through `scripts/find-build.ts` and `scripts/ci-slowest-tests.ts`. — [package.json#L20-27](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/package.json#L20-L27) [scripts/find-build.ts](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/scripts/find-build.ts) [scripts/ci-slowest-tests.ts](https://github.com/oven-sh/bun/blob/bf80d21c69c355f6e5bae2749485674663ed13a1/scripts/ci-slowest-tests.ts)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
