Quick article to help look at the right place when configuring your tests in Jest.
Default test files location
The first time I read through the configuration I thought that the paths to my tests were configured using testPathDirs . It turns out that this property is only used to restraint the places Jest will look for tests to sub modules.
The important thing to note is that by default:
Jest will look for ’js
and .jsx
files inside of __tests__
folders.
Use a custom location
This is the default that needs to change. To do so, use testRegex.
For example, if you want to store all your test files inside a ./tests
folder, the only jest configuration option you are going to need is:
“jest”: { |