Add roots to jest.config
What does this MR do and why?
This MR addresses this issue raised by @cwoolley-gitlab where a large file being present in coverage/
caused jest to blow up:
I’m unable to run jest specs locally, getting this error:
$ yarn jest ./ee/spec/frontend/remote_development/components/common/get_project_details_query_spec.js yarn run v1.22.19 $ yarn check-dependencies $ scripts/frontend/check_dependencies.sh $ jest --config jest.config.js ./ee/spec/frontend/remote_development/components/common/get_project_details_query_spec.js Error: Cannot create a string longer than 0x1fffffe8 characters at Object.slice (node:buffer:646:37) at Buffer.toString (node:buffer:865:14) at Object.readFileSync (node:fs:515:41) at getContent (/Users/cwoolley/workspace/gitlab-development-kit/gitlab/node_modules/jest-haste-map/build/worker.js:137:22) at Object.worker (/Users/cwoolley/workspace/gitlab-development-kit/gitlab/node_modules/jest-haste-map/build/worker.js:165:23) at execFunction (/Users/cwoolley/workspace/gitlab-development-kit/gitlab/node_modules/jest-worker/build/workers/processChild.js:137:17) at execHelper (/Users/cwoolley/workspace/gitlab-development-kit/gitlab/node_modules/jest-worker/build/workers/processChild.js:116:5) at execMethod (/Users/cwoolley/workspace/gitlab-development-kit/gitlab/node_modules/jest-worker/build/workers/processChild.js:120:5) at process.messageListener (/Users/cwoolley/workspace/gitlab-development-kit/gitlab/node_modules/jest-worker/build/workers/processChild.js:38:7) at process.emit (node:events:514:28) error Command failed with exit code 1.
Screenshots or screen recordings
This should dramatically improve the startup time for jest
. By specifying roots
, jest
won't try to read Everything-Everywhere-All-At-Once.
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
Run yarn run jest
or yarn run jest:integration
locally for a specific test file.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Paul Slaughter