-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(jest): Fix watchmode on api tests #6438
fix(jest): Fix watchmode on api tests #6438
Conversation
…e context as jest
@dac09 Do you think we should add a tip in https://redwoodjs.com/docs/testing#jest with: What do I do if my api side tests run out of memory on CI?One of the things we can suggest is to use Jest 28+'s sharding. e.g.
(adjust the number of shards as needed. 50 or so test-suites per shard is a good number!) This will allow tests to run to completion.
|
Sure - I just don’t know if that’s the right place to put it. Because it’s most likely something you see in CI. |
fwiw - I am seeing odd test errors that may or may not be related to this PR:
|
...by loading scenarios in the same context as jest.
This unfortunately is a compromise, because the work I did to improve the memory usage of our scenario tests gets a little nullified now.
What is the change?
One of the memory optimisations I did was to make sure scenarios are loaded and seeded outside the context/VM that the tests run in. This seemed to really help with memory usage, but unfortunately breaks tests in watch mode, with a cryptic DB/Prisma error (on Postgres):
This PR now puts back the scenario loading and seeding back in the same context, while keeping some of the other minor optimisations, as well as the tests that don't use scenarios being fast.
What do I do if my api side tests run out of memory on CI?
One of the things we can suggest is to use Jest 28+'s sharding.
e.g.
(adjust the number of shards as needed. 50 or so test-suites per shard is a good number!)
This will allow tests to run to completion