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.
71
Tests with assert
node:assert/strict, deep equality, a thrown error, and one assert per test
Open
72
Test layout
tests that mirror src, a .test.ts name, tsc plus node, and a fresh import
Open
73
Fixtures
a small JSON fixture, a temp folder per run, and the cleanup after
Open
74
Test doubles
hand-written fakes, a stub, a spy that records calls, and time as a value
Open
75
CI tests
one npm test script, a non-zero exit that fails the build, and a blocked merge
Open