@marginallyuseful/soll-bun
v0.0.1-c591f86e
Published
Bun test integration for soll — scopes test runs to affected files
Readme
@soll/bun
Bun test integration for soll — scope test runs to only affected files.
Prerequisites: Install soll and run soll diagnose --write in your project first.
Quick start
Install and add the preload script to your bunfig.toml:
npm install --save-dev @soll/bun# bunfig.toml
[test]
preload = ["@soll/bun/preload"]That's it. When you run bun test, soll intercepts test file loading and skips tests not affected by your changes.
How it works
The preload script hooks into Bun's plugin system. It builds the import graph once, computes the affected set from git diff, then replaces non-affected test files with empty modules at load time. Affected tests and all non-test dependencies pass through normally.
If the native addon or git isn't available, it falls back to running all tests.
Programmatic API
For custom integrations:
import { getAffectedTests } from "@soll/bun";
const result = getAffectedTests({
root: process.cwd(),
include: await glob("**/*.ts"),
changedFiles: ["src/logger.ts"],
tests: ["src/logger.test.ts", "src/app.test.ts"],
});
// result.affectedTestFiles → ["src/logger.test.ts"]Development
pnpm install
pnpm --filter @marginallyuseful/soll-bun build
pnpm --filter @marginallyuseful/soll-bun typecheck