.js files placed in the
__tests__ directory will be treated as tests
by Jest when running
yarn test. If you don't want to place all of your
files in that directory and especially if you want to co-located your test
files with the source files, you can name them with the
Any files in your create-react-app project ending in these suffixes will be treated by Jest as test files and included in test runs.
There are more details in the docs.Tweet