Specialty Testing
Visual regression, mutation, contract, and coverage testing.
For unit / E2E / component testing see Testing. This page covers the specialized branches.
Visual regression
- ★ Chromatic — Storybook-native; every PR gets visual diffs. Generous free tier; paid above.
- ★ Argos CI — Playwright-native; cheaper than Chromatic if you don't use Storybook; generous free tier.
- Percy (BrowserStack) — pioneer; full-page diffs.
- Loki (Storybook plugin) — open source self-host visual regression.
- BackstopJS — older, self-host, configuration-driven.
- Playwright
toHaveScreenshot()— built-in; pair with a CI cache for diffs. reg-cli/ reg-suit — minimal screenshot diff tool.
Mutation testing
- ★ Stryker Mutator — JS / TS / .NET / Scala. Mutate your code, run your tests, see what should fail but doesn't. The default for measuring test quality (vs. test coverage).
- PIT (Java) — non-JS but worth knowing.
Contract testing
- ★ Pact — consumer-driven contracts; the standard. JS / Python / Go / Java / .NET. Hosted Pact Broker or self-host.
- Spring Cloud Contract — Java-flavored.
- Schemathesis — property-based, OpenAPI-driven (see OpenAPI Tooling).
- Optic — captures live API traffic and diffs against spec.
Coverage
- ★ c8 — uses native V8 coverage; what Vitest uses by default. The fastest.
- Istanbul (
@vitest/coverage-istanbul,nyc) — instrumentation-based; produces the same reports. @vitest/coverage-v8— Vitest's c8-flavored.- Codecov / Coveralls — hosted reporting; generous free tiers; PR comments with coverage diffs.
Property-based / fuzz testing
- ★ fast-check — TS-first property-based testing; integrates with Vitest / Jest. The default.
@hapi/hoek— runtime contract checks.- jsfuzz — JS fuzzer.
- Atheris (Python), AFL++, libFuzzer — non-JS.
- OSS-Fuzz — Google's continuous fuzzing for OSS projects.
Snapshot testing patterns
- Vitest's
toMatchSnapshot()/toMatchInlineSnapshot(). - Jest's same APIs.
- Use sparingly — easy to commit broken snapshots without noticing.
API / load testing
- See Load Testing — k6, Artillery, Autocannon.
Accessibility testing
- See Accessibility Testing — axe, Pa11y, jsx-a11y.
End-to-end with auth / state
- Playwright auth state —
storageState; reuse logged-in session across tests. @playwright/testprojects — split tests by browser / device.- Vitest browser mode — run unit tests in a real browser.
- Faker.js + factories — see Faker & Seed Data.
Patterns to know
- Visual regression on Storybook stories — much faster than full-page snapshots; isolates components.
- Mutation testing as a periodic CI job, not per-PR — too slow for inline gating.
- Contract tests in monorepos — Pact for cross-service contracts; tRPC / oRPC types for same-repo.
- Coverage thresholds — set realistic ones (70–85% line is healthy); track trend, not absolute.
- Don't chase 100% coverage — diminishing returns; quality > quantity.
Pick this if…
- Default visual regression with Storybook: Chromatic.
- Default visual regression with Playwright: Argos.
- Self-host visual regression: Loki.
- Measure test quality (not just coverage): Stryker.
- Contract testing across services: Pact.
- Coverage reports + PR comments: Codecov.
- Property-based / fuzz: fast-check.