Testing

This part writes tests with node:assert/strict, a layout that mirrors the source, fixtures written into a temporary folder, and fakes, stubs and spies in place of a real dependency. The last lesson puts the whole run into one npm script that fails the build.

9.1 Tests with assert node:assert/strict, deep equality, a thrown error, and one assert per test Open 9.2 Test layout tests that mirror src, a .test.ts name, tsc plus node, and a fresh import Open 9.3 Fixtures a small JSON fixture, a temp folder per run, and the cleanup after Open 9.4 Test doubles hand-written fakes, a stub, a spy that records calls, and time as a value Open 9.5 CI tests one npm test script, a non-zero exit that fails the build, and a blocked merge Open

Lessons