Testing strategy and quality gates
Six steps to lock down regressions with vitest, pytest, Playwright, and testcontainers.
- Difficulty
- intermediate
- Lessons
- 6
- Total time
- 160 min
Testing strategy and quality gates
More tests do not equal safer. Absent tests do not equal faster. The real design choice is which layers to emphasise for your project size, team, and cost of an incident.
Who it's for
- People endlessly stuck on "which test do I write here?"
- Folks running vitest, pytest, and Playwright in one repo
- Teams who want the CI green light to actually mean something
What you can do afterwards
- Apply the test pyramid (80% unit · 15% integration · 5% E2E) in practice
- Standardise vitest mocks with
vi.hoisted - Use pytest fixtures and parametrize well
- Run real PostgreSQL in tests with testcontainers
- Auto-generate Playwright smoke manifests
- Block PRs on GitHub Actions
Steps
- Test pyramid · trade-offs — cost vs confidence · picking layers
- vitest basics + mock patterns —
vi.hoisted·vi.stubEnv· node vs jsdom - pytest · fixture · parametrize — conftest · async · coverage
- testcontainers — real PostgreSQL containers + idempotent seeding
- Playwright E2E — auto manifests ·
@writePROD skip - GitHub Actions quality gate — PR block · artifacts · Slack
Prerequisites — getting-started + any prior test writing experience.