Section 11: Integration Testing with Testcontainers
- The limits of mocking the database and why you need to test against a real one
- Using @testcontainers/postgresql to start a temporary PostgreSQL instance
- Migrating the schema and preparing test fixtures
- Isolating data between tests and cutting run time with global setup
- Lab: run repository tests against real PostgreSQL in a container
Section 12: Code Coverage
- Line, branch and function coverage with Vitest coverage (V8)
- Setting coverage thresholds that suit the project
- The limits of coverage as a measure of test quality
- Lab: read the coverage report and add tests for untested branches
Section 13: Mutation Testing with StrykerJS
- How mutation testing works and what the mutation score means
- Setting up StrykerJS with the Vitest runner
- Analysing surviving mutants and improving the tests
- Lab: raise the mutation score of the domain logic by strengthening weak assertions
Section 14: Bringing TDD into CI and Team Practice
- Running unit and integration tests in CI with GitHub Actions or GitLab CI
- A quality gate based on tests, coverage and type checks
- Applying TDD to legacy code with characterisation tests
- Code reviews that give tests proper attention
- Lab: set up a pipeline that blocks merging when tests fail
Section 15: Master Workshop: A Production-ready ParcelPoint
- Replace the fake repository with real PostgreSQL through Testcontainers and write integration tests for the main flows
- Run coverage and StrykerJS to find weak tests and improve them
- Add an express delivery fee feature test-first, from the first test to the endpoint
- Set up a CI pipeline with a quality gate, then present the result and review the code together