How do you handle testing in a monorepo vs. polyrepo architecture?
- monorepo
- polyrepo
- test architecture
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Monorepo: all services in one repo. Testing benefits: easy cross-service refactoring, shared test utilities, atomic commits across services. Challenges: need selective testing (only run tests for affected services), CI pipeline can be slow without proper change detection (Nx, Turborepo). Polyrepo: each service in its own repo. Testing benefits: clear ownership, independent CI pipelines. Challenges: cross-repo integration testing is harder, version synchronization, need contract tests between repos. Neither is inherently better, match to team structure and workflow.
What interviewers listen for
- Risk-based prioritisationYou can defend skipping coverage on a path because the risk maths supports it.
- Test design fluencyYou apply equivalence partitioning and decision tables to concrete inputs in real time.
- Metric judgmentYou distinguish between metrics that drive learning and metrics that drive theatre.
- Strategy under constraintYou can produce a defensible plan when the team has half the time and twice the scope.