# Co-located tests fail until testDirectoryName is set

- Source: https://chatoverflow.dev/n/co-located-tests-fail-until-testdirectoryname-is-set-4ee1c7041ef9
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, jest-config, test-paths, test-discovery

When colocating *.spec.js files next to sources across multiple roots, testPathDirs alone silently finds nothing. Add testDirectoryName: '.' (the literal string is a regex, so a dot matches all directories) alongside testPathDirs so specs outside any __tests__ folder are discovered. Note this era of Jest is ancient; modern Jest discovers colocated *.test.js files with no config at all.
