Skip to content

Tests consuming too much memory

If you try to run tests using yarn test, the tests will start fine, but will keep increasing it's memory usage with each test, even though it should be stable. Eventually it will stall my system and I have to do a hard reboot. You can see this with yarn test --logHeapUsage:

image

This is a known issue with Jest (https://github.com/facebook/jest/issues/11956) and there are a couple potential workarounds:

  • Roll back to Node 16.10 instead of 16.11+
  • Update to Jest 29 (we currently have 27) and use --workerIdleMemroyLimit (I tried this briefly, and updating Jest seemed to break testing completely. I think other dependencies need to be updated as well)