6
Module 6
Engineering quality
Testing the pyramid honestly, debugging as a learnable loop, refactoring you can defend.
Module roadmap
3 chapters ยท 50 lessons
Testing
Ch 1917 lessons
The pyramid honestly, Vitest, integration, Playwright, mocking, CI. The skill that lets you change code without breaking it.
- 19.0Orientation: why this chapter exists
- 19.1Why test (the real reasons)
- 19.2The testing pyramid, correctly drawn
- 19.3Unit tests with Vitest
- 19.4Test structure: arrange, act, assert
- 19.5Test data builders and factories
- 19.6Test-double taxonomy: stub, fake, spy, mock
- 19.7What to mock, what never to mock
- 19.8Integration tests for the API
- 19.9Database in tests: container vs in-memory vs real
- 19.10End-to-end tests with Playwright
- 19.11Snapshot tests: when they help, when they rot
- 19.12TDD as a habit, not a religion
- 19.13Coverage that means something
- 19.14Flaky tests: detection, isolation, fix
- 19.15Continuous integration with GitHub Actions
- 19.assignAssignment: 80% meaningful coverage and one Playwright happy-path
Debugging
Ch 2017 lessons
Hypothesis โ experiment โ observe โ update. Stack traces, dev tools end to end, the VSCode debugger, git bisect. The skill nobody teaches.
- 20.0Why you stop guessing today
- 20.1The debugging loop: hypothesis, experiment, observe, update
- 20.2Stack traces, top to bottom
- 20.3DevTools Elements end to end
- 20.4DevTools Console as a debugging tool
- 20.5DevTools Network deep dive
- 20.6DevTools Sources and breakpoints
- 20.7DevTools Performance, at a level you can use today
- 20.8DevTools Memory, at a level you can use today
- 20.9The VSCode debugger for Node
- 20.10The VSCode debugger for the browser
- 20.11Logging strategies: levels, structure, when to log
- 20.12`console.log` debugging as a skill, not a sin
- 20.13`git bisect`: binary search the regression
- 20.14Rubber-ducking and when to walk away
- 20.15Reading other people's error messages
- 20.assignAssignment: Twelve planted bugs
Refactoring
Ch 2116 lessons
Named smells, extract function/module, refactoring under and without tests, strangler-fig. Reading large unfamiliar code without panicking.
- 21.0Orientation: what refactoring is, and the three goals you refactor toward
- 21.1Why refactor: the boring honest answer
- 21.2Reading large unfamiliar codebases in thirty minutes
- 21.3The six named smells you'll see all year
- 21.4Extract function: by hand and with VSCode
- 21.5Extract module: moving a group of functions into their own file
- 21.6Rename: the most underused refactor
- 21.7Replace conditional with polymorphism โ when it earns its weight
- 21.8Refactoring under tests: scaffolding for safe change
- 21.9Refactoring without tests: characterisation first
- 21.10The boy-scout rule: leave it slightly better
- 21.11Strangler-fig migrations: replacing a system one route at a time
- 21.12The cost of premature abstraction
- 21.13Dependency graphs and what they tell you
- 21.14Tooling: VSCode refactors, ts-morph, and codemods
- 21.assignAssignment: refactor a messy starter three times โ readability, testability, performance