testing

Installation
SKILL.md

Testing

Follow these rules when writing tests. These are generic guidelines. If a language specific guideline (e.g. one from the typescript-test-guidelines skill) conflicts, then follow that instead.

Definitions

  • A unit test aims to check the behaviour of a single module in isolation. Mocks and stubs are used when necessary (e.g. to avoid calling an external service during testing). The test files should have low fan-out.
  • An integration test aims to check how multiple modules interact. It's acceptable to have moderate fan-out, since multiple modules are tested at once.
  • An end-to-end (e2e) test aims to test the entire system. If the system interacts with an external service (e.g. calls a remote server) then that should be mocked, but otherwise not. They should have low fan-out since there's a single system under test (SUT). The tests should typically only import fixtures and any tools required to setup the SUT.

Test pyramid

Prioritize creating unit tests over integration tests and integration tests over e2e tests. Only create e2e tests if the behaviour cannot be adequately tested with integration or unit tests. Only create integration tests if the behaviour cannot be adequately tested with unit tests.

Ideally projects should have many unit tests, some integration tests and a few e2e tests.

Magic numbers

Installs
2
GitHub Stars
8
First Seen
Aug 29, 2026
testing — freecodecamp-universe/marketplace