{"id":21817903,"url":"https://github.com/iansu/jest-runner-iansu","last_synced_at":"2026-04-12T01:32:30.671Z","repository":{"id":40239162,"uuid":"493776836","full_name":"iansu/jest-runner-iansu","owner":"iansu","description":"A patched version of the default jest-runner that prevents out of memory issues","archived":false,"fork":false,"pushed_at":"2022-05-31T21:54:32.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T14:18:38.299Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iansu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-18T18:14:07.000Z","updated_at":"2022-05-28T20:24:59.000Z","dependencies_parsed_at":"2022-07-24T17:32:08.899Z","dependency_job_id":null,"html_url":"https://github.com/iansu/jest-runner-iansu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fjest-runner-iansu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fjest-runner-iansu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fjest-runner-iansu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iansu%2Fjest-runner-iansu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iansu","download_url":"https://codeload.github.com/iansu/jest-runner-iansu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244236077,"owners_count":20420759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T15:48:59.217Z","updated_at":"2026-04-12T01:32:30.624Z","avatar_url":"https://github.com/iansu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jest-runner-iansu\n\nThis is a patched version of [`jest-runner`](https://github.com/facebook/jest/tree/main/packages/jest-runner) that shuts down the worker when it has used more than 80% of the available heap memory. Jest will automatically spawn a new worker and continue running the tests. This prevents any out of memory errors.\n\n## Usage\n\nInstall the runner with npm or Yarn. Make sure you install the version that corresponds to your Jest version. For example, if you are using Jest 28:\n\n```sh\nnpm i -D jest-runner-iansu@28\n```\n\n```sh\nyarn add --dev jest-runner-iansu@28\n```\n\nAdd this line to your Jest config:\n\n```js\nrunner: 'jest-runner-iansu'\n```\n\n## How it works\n\nThis patch only requires adding a few lines of code to the [`testWorker.js`](packages/jest-27/build/testWorker.js) file:\n\n```js\nconst heap = v8.getHeapStatistics();\n\nif (heap.total_heap_size / heap.heap_size_limit \u003e 0.8) {\n  (0, _exit().default)(1);\n}\n```\n\nWhen a test is dispatched to the worker we first check if the heap usage is above 80%. If it is, the worker just exits with a non-zero exit code. Jest will automatically detect this and spawn a new worker. If the heap usage is below 80% the worker runs the test as usual.\n\n\u003e **Note**\n\u003e I've opened an issue in Jest to see if it might be possible to build this into the default test runner and expose the threshold via a config setting/CLI argument: https://github.com/facebook/jest/issues/12893\n\n## License\n\nThe original `jest-runner` is released under the MIT license as are all changes in the patched versions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansu%2Fjest-runner-iansu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiansu%2Fjest-runner-iansu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiansu%2Fjest-runner-iansu/lists"}