News for hackers. Stuff that matters.
Re:Delightful React file/directory structure by azemetre on Tuesday March 15, 2022 @12:42PM (#30687504)
hmm. I honestly never used CRA outside of an interview assessment and don't really remember much. Early on in my web career I was encouraged to create my own scaffolding tools, that practice just always stuck with me.

Kinda curious to learn how they enforced directory structures. I know now they co-locate tests, but IIRC CRA always used jest and with jest you just set the globs you want to use in the config file. Hardly hardcoded or strictly enforced, but I could be wrong.

Re:Delightful React file/directory structure by notapenny on Tuesday March 15, 2022 @01:33PM (#30688267)
Could also be that I'm remembering it wrong, but I recall having some issues with CRA and structuring tests at some point. In any case, CRA sets up a separate src and test folder, so I guess a lot of people just think they should structure their tests that way.
Re:Delightful React file/directory structure by mikewhy on Thursday March 17, 2022 @02:36PM (#30714439)
CRA doesn't enforce any structure, outside of "code lives in arc/ and public files go in public/"

The default templates are just a single folder, with tests located adjacent to their source files.

CRA configures jest to look for test files in arc/, but let's users override that.

https://github.com/facebook/create-react-app/tree/main/packa...

https://github.com/facebook/create-react-app/tree/main/packa...