Skip to content

Commit 7ef61b2

Browse files
Make vitest run only affected tests by default (#287)
1 parent 2a87a2e commit 7ef61b2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Several services are singletons (e.g., `OAuthAuthManager`, `CooldownManager`, `D
129129
### Other rules
130130
- `packages/backend/bunfig.toml` blocks raw `bun test` — use `bun run test` / `bun run test:watch`
131131
- Root `bunfig.toml` blocks raw `bun test` at repo root — use `cd packages/backend && bun run test`
132+
- **Prefer `bun run test` (affected only) over `bun run test:force-all`.** The default test command uses `--changed HEAD` and runs only tests affected by uncommitted changes — use it unless you have a specific reason to run the full suite (e.g., verifying a cross-cutting refactor or diagnosing flakiness unrelated to your changes). Never reach for `test:force-all` out of habit.
132133
- If you must mock a module, implement its **full public interface**
133134
- Do not use `__mocks__` directories for node_modules mocks — they are not reliably loaded with `isolate: false` when the real module may already be cached
134135

packages/backend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"start": "bun run src/index.ts",
77
"dev": "bun run --watch src/index.ts",
88
"typecheck": "bun x tsc --noEmit",
9-
"test": "bunx --bun vitest run --config vitest.config.ts",
9+
"test": "bunx --bun vitest run --config vitest.config.ts --changed HEAD",
10+
"test:force-all": "bunx --bun vitest run --config vitest.config.ts",
1011
"test:watch": "bunx --bun vitest --config vitest.config.ts",
1112
"rekey": "bun run src/cli/rekey.ts"
1213
},

0 commit comments

Comments
 (0)