Skip to content
h2check
ChecksToolsChecklists
Checks

Test environments and doubles

18 procedures covering feature flags per environment, fake time and clocks, mock and stub servers, seed and fixture data, environment variables and config drift. Out of scope here: test framework selection, CI pipeline design.

Environment and Data

  • How to check config drift between environments9 min
  • How to check feature flags in test environment10 min
  • How to check for secrets in environment variables12 min
  • How to check if env variable exists7 min
  • How to check seed data in test database12 min
  • How to mock environment variables in vitest8 min

Test Doubles

  • How to mock fetch in vitest12 min
  • How to reset mocks between tests12 min
  • How to simulate slow network in chrome9 min
  • How to spy on a function in jest11 min
  • How to test with a mock server10 min
  • How to verify a mock was called9 min

Test Isolation

  • How to check test isolation12 min
  • How to check why jest did not exit after tests13 min
  • How to detect parallel test interference14 min

Time and Clocks

  • How to mock date in jest10 min
  • How to run jest tests with a specific timezone12 min
  • How to test with fake time12 min

Checklists

  • Test environment checklist16 checks

Questions people ask about this area

  • what is the difference between a mock and a stub
  • why do fake timers time out a test
  • what is the difference between fixtures and seed data

h2check.org is published by Maks Verny. Every procedure lists the date its commands were last run.

Checks · Tools · Checklists

Methodology · About · Contact

Checker inputs and results are not stored. What that means in practice is on the methodology page.