Testing
How the active Bun monorepo tests the CLI, provider packages, and proof apps.
Overview
- Goal: protect the developer-facing contract, not maximize line coverage.
- Focus: CLI behavior, generated workspaces, watch/runtime behavior, and publish outputs.
- Primary surfaces:
orchestrators/bun/tests/**plus package-localtests/**. - Default gate: deterministic package checks, package smoke where exposed, orchestrator contract/integration tests, and browser proofs for both publish and watch behavior.
- Focused watch-browser commands and workflow remain available for direct reruns when you want isolated watch diagnostics.
What We Test
- CLI workflows:
init,build,watch,test,publish,smoke, and generators - Contracts: folder layout, emitted artifacts, exit codes, and manifest summaries
- Watch behavior: HMR, reloads, backend restarts, and
/api/*proxying - Canonical
webstir testproof workspace:full, kept near the built-infulltemplate except for explicit watch/runtime proof deltas - Proof apps:
auth-crudanddashboardas consumer-path browser validation for both publish and watch behavior, not separate requiredwebstir testlanes - Package behavior inside
@webstir-io/webstir-frontend,@webstir-io/webstir-backend, and@webstir-io/webstir-testing
Test Types
- Orchestrator integration tests under
orchestrators/bun/tests/**/*.ts - Package tests under
packages/tooling/*/tests/**/*.test.js - Package smoke scripts where a package exposes
bun run smoke - Browser publish proofs in the default Bun orchestrator gate
- Browser watch proofs in the default Bun orchestrator gate, with a separate focused rerun workflow
Running Tests
- Repo-wide active workspaces:
bun run test - Repo-wide formatting baseline:
bun run format - Repo-wide formatting check:
bun run check:biome - Repo-wide lint sweep:
bun run lint - Repo-wide required tests plus watch browser tests:
bun run test:with-watch-browser - Watch browser tests:
bun run test:watch-browser - Repo required CI mirror:
bun run check:required - Repo release gate:
bun run check:release - Repo required CI mirror plus watch browser tests:
bun run check:with-watch-browser - Bun orchestrator only:
bun run --filter @webstir-io/webstir test - Bun orchestrator required tests plus watch browser tests:
bun run --filter @webstir-io/webstir test:with-watch-browser - Bun orchestrator watch-browser tests:
bun run --filter @webstir-io/webstir test:browser:watch - Frontend package:
bun run --filter @webstir-io/webstir-frontend test - Backend package:
bun run --filter @webstir-io/webstir-backend test - Generated workspace tests:
webstir test --workspace /absolute/path/to/workspace - Canonical repo example:
bun run webstir -- test --workspace "$PWD/examples/demos/full"
How webstir test Works
- Rebuild the required workspace surfaces.
- Discover tests under
src/**/tests. - Compile them into
build/**. - Run the compiled suites through the canonical testing provider.
Only webstir test supports --runtime <frontend|backend|all>.
In this repo, examples/demos/full is the canonical workspace for the webstir test flow. It stays aligned with orchestrators/bun/resources/templates/full/src/** outside a small set of proof-only watch/runtime files, and bun run --filter @webstir-io/webstir check:full-demo-sync enforces that boundary. auth-crud and dashboard belong to the browser-proof layer instead: publish-mode and watch-mode browser coverage now live in the required gate, while the focused Watch Browser Tests workflow remains useful for isolated reruns. Any app-local tests inside those demos should be treated as reference coverage rather than a separate required gate.
What We Avoid
- Treating archived
.NETharnesses as the current source of truth - Documenting unsupported flags or workflows as if they were active
- Locking tests to private implementation details when a contract-level assertion is enough
Reliability Notes
- Integration tests use isolated temp workspaces and copied fixtures.
- Watch tests prefer explicit readiness and port checks over long sleeps.
- Browser flows focus on shipped proof apps so regressions surface on real consumer paths.
- PR and
mainshould run the same required gate; usebun run check:requiredfor the CI mirror,bun run check:with-watch-browserwhen you want the watch-browser proof lane, andbun run check:releasewhen you want the release-ready gate that includes the recipe-app benchmark. - GitHub
CIrunsbun run check:required; theWatch Browser Testsworkflow remains manual as a focused rerun path and runsbun run test:watch-browseron demand.