Hello. I’m wondering if it’s possible to use the --watch
switch anywhere so the tests rerun automatically when the code changes.
If you’re working locally, I don’t see why not. In the editor? No, it doesn’t support something like that. One of the advantages of working offline is that you have more flexibility to try different things like running tests automatically.
I wasn’t sure how to go about doing that, but after mucking about for a bit, I found that adding this to the scripts section in package.json seemed to do the trick
"test:watch": "corepack yarn jest --watch --no-cache",
Does that seem correct? I assume this isn’t the full test suite, but it seems to be the main ones.
1 Like
This works, and you can also not add it to package.json but call it directly:
yarn test --watch
I dont know what you mean with “main ones” regarding the test suite.