mercredi 17 juin 2020

Jest Folder Structure

I'm currently employing the use of Jest in my CRA application. I see that CRA opted for the use of filename.test.js format when writing tests but I find this approach a bit cumbersome on the eyes and brain. I found out that you can write tests in a folder named __tests__ and jest will automatically run the tests in that folder. I like this approach. My question now is, what is the standard when using this setup? Usually, my src folder is set up as such:

src ---
       |
       components
                 |
                 some1ComponentDir
                 |
                 some2ComponentDir  

Do I create a __tests__ folder at each level or do I mock the structure of my src folder inside of my __tests__ folder located inside the src folder?

If you think this is a silly question, please just ignore it and move on. Thanks for any help.

Aucun commentaire:

Enregistrer un commentaire