A similar question was asked back in May of last year but unfortunately didn't get any responses so I'd like to expand on it with some details of my own and hopefully gain some understanding of how --findRelatedTests
works, because there doesn't seem to be any documentation that describes how it works, just that it does.
In short, what criteria needs to be in place for this for --findRelatedTests
to work properly?
Do the source file/test file need to be similarly named?
e.g.
Page.jsx
andPage.test.js
Do the test files need to be in the same folder as the source file, or should they be placed in a separate tests folder?
I ask because I tend to follow the AirBnb project structure for my applications:
- components
- Page
- index.jsx
- style.scss
- Page.test.js
...and I'd like to know if I updated the Page component index.jsx
file whether --findRelatedTests
would "know" that Page.test.js
is the associated test file?