ref: https://stackoverflow.com/a/62885391
Run test with the following command:
node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage
--expose-gc
is V8 options (seenode --v8-options
)--logHeapUsage
: https://jestjs.io/docs/cli#--logheapusage
workaround: https://jestjs.io/docs/configuration#workeridlememorylimit-numberstring
- Bump jest to v29.5 or over
- Set
workerIdleMemoryLimit
injest.config.ts
import { type Config } from "jest";
const config: Config = {
workerIdleMemoryLimit: "500MB",
};
export default config;