Module not found during tests
The test runtime could not resolve a package, local module, generated artifact, or configured path alias.
RECOGNIZABLE ERROR
Cannot find module 'package-name'RANKED DIAGNOSIS
What usually causes it
- 01
The dependency is missing from the locked install
A transitive or globally installed local dependency hid the omission.
DIAGNOSE
Install from the lockfile in a clean environment and inspect direct dependencies.
FIX
Declare the package in the correct production or test dependency group.
- 02
Path aliases differ between compiler and runner
TypeScript may resolve an alias that Jest or another runner does not know.
DIAGNOSE
Compare tsconfig paths with the test runner's module mapping.
FIX
Derive both configurations from one alias source or mirror them explicitly.
- 03
A generated file was not created
Schema clients, code generation, or build artifacts may be absent in CI.
DIAGNOSE
Check the generation step and expected file before starting tests.
FIX
Run deterministic generation after install and cache only compatible output.
Prevent the repeat
- →Test clean lockfile installs.
- →Align resolver configuration.
- →Verify generated artifacts before collection.
Primary references
Run this against your evidence
The browser triage workflow uses the same stable pattern slug and does not upload your paste.