No more __snapshots__ folders with Jest!

Csaba Apagyi
Componently
Published in
1 min readNov 5, 2018

Jest has always been placing snapshots in the __snapshots__ folder right next to your tests. A convention similar to the __tests__ folder. This might not have been to your liking, especially if you co-locate tests with your code. In case of tests the testRegex option allowed for other approaches but there was no escape from __snapshots__ until now.

A new configuration in Jest v24 allows you to configure where snapshots are located relative to their corresponding test files and vice versa. This feature can already be used when installing jest@beta. Slightly modifying the example configuration the following setup will place snapshots right next to test files:

You can find other things I care about on Medium and GitHub.

--

--