Jest Testing Workflow
Trigger Boundary
- •Use when JS/TS test implementation relies on Jest.
- •Do not use for end-to-end browser runs; use
playwrightortesting-e2e. - •Do not use for language-agnostic testing policy only.
Goal
Deliver maintainable Jest suites with deterministic behavior and clear failure signals.
Inputs
- •Module behavior and test target scope
- •Mocking boundaries and dependency behavior
- •Runtime environment (node/jsdom) constraints
Outputs
- •Test suite structure and mock strategy
- •Assertion plan for happy, edge, and failure paths
- •Execution profile plan (watch mode, CI mode, coverage)
Workflow
- •Define test scope by module responsibility and risk.
- •Set environment and mocking boundaries explicitly.
- •Write focused tests with minimal, meaningful assertions.
- •Use fake timers and async controls intentionally.
- •Keep coverage goals aligned to behavior risk, not raw percentages.
Quality Gates
- •Mock usage does not hide integration-critical behavior.
- •Async tests are stable and free from timing flakiness.
- •Assertions are specific enough to localize failures quickly.
- •CI execution settings are reproducible from local commands.
Failure Handling
- •Stop when mock strategy breaks behavior realism.
- •Escalate when flakiness persists despite deterministic controls.