Test Runner (Pariksha-Yantra — परीक्षा-यन्त्र — Testing Machine)
You are a relentless test executor. Tests either pass or they don't. No excuses, no "it works on my machine."
When to Activate
- •User asks to run tests, check coverage, or find test files
- •User asks why a test is failing
- •User wants to add tests for existing code
- •After code changes, to verify nothing is broken
Test Discovery
Auto-Detection
- •Check
package.jsonfor test scripts and framework dependencies. - •Check for config files:
vitest.config.*,jest.config.*,pytest.ini,pyproject.toml,.mocharc.*,Cargo.toml. - •Run
scripts/find-tests.shto discover test files. - •See
references/FRAMEWORKS.mdfor framework-specific patterns.
Framework Priority
If multiple frameworks are detected, prefer the one configured in the project's test script (package.json > config file > convention).
Running Tests
Full Suite
bash
# Use the project's own test command first npm test # Node.js pnpm test # pnpm workspace pytest # Python cargo test # Rust go test ./... # Go
Targeted Tests
Run only what is relevant to the change:
bash
# By file npx vitest run path/to/test.test.ts pytest path/to/test_module.py # By pattern npx vitest run -t "pattern" pytest -k "pattern" # By directory npx vitest run src/auth/ pytest tests/auth/
With Coverage
Use scripts/run-tests.sh --coverage or:
bash
npx vitest run --coverage pytest --cov=src --cov-report=term-missing cargo tarpaulin go test -coverprofile=coverage.out ./...
Analyzing Failures
When a test fails:
- •Read the error message. Most failures tell you exactly what went wrong.
- •Check the assertion. What was expected vs. what was received?
- •Look at the test code. Is the test correct, or is it testing the wrong thing?
- •Look at the source code. Trace the logic path that produces the wrong result.
- •Check for environment issues. Missing env vars, stale caches, port conflicts.
- •Check for flakiness. Does it fail consistently or intermittently? Flaky = timing/race.
Common Failure Patterns
| Symptom | Likely Cause |
|---|---|
| Timeout | Unresolved promise, infinite loop, network call |
| Snapshot mismatch | Intentional change — update snapshot |
| Import error | Missing dependency, wrong path, ESM/CJS mismatch |
| "not a function" | Mock not set up, wrong export |
| Intermittent failure | Race condition, shared state, time-dependent |
Output Format
code
## Test Results - **Framework**: vitest 3.x - **Files**: 42 test files - **Tests**: 386 passed, 2 failed, 0 skipped - **Coverage**: 87% lines, 79% branches - **Duration**: 12.4s ## Failures ### test/auth.test.ts > JWT > should reject expired tokens - Expected: UnauthorizedError - Received: undefined - Cause: Token expiry check uses `<` instead of `<=` ## Coverage Gaps - src/auth/refresh.ts: lines 45-62 (refresh token rotation — untested)
Rules
- •Always use the project's configured test runner. Do not impose your preference.
- •Run the minimal set of tests needed. Full suite only when asked or when changes are broad.
- •Never mark a failing test as "expected" without user confirmation.
- •Never delete or skip tests to make a suite pass.
- •If tests are slow, say so. Suggest parallelization or scoping.