Warm up Jest cache before running tests
What does this MR do and why?
Warm up Jest cache before running tests in CI
This is an attempt to reduce the frequency with which Jest jobs fail due to timeouts in CI.
Experiments conducted in !150196 (merged) show that Jest spec run time in CI is highly variable and inconsistent. This can also be seen in the latest Jest speed report: https://gitlab-org.gitlab.io/frontend/playground/jest-speed-reporter/. See also #457179 (closed).
One way to mitigate this is to reduce the amount of work Jest needs to
do in each job by preparing an import cache for Jest and providing it to
each job. This cache should prevent some unnecessary IO/compute on
these jobs, mostly around transpilation of files, done by at least
vue2-jest
, babel
, and our GraphQL transformer.
This seems to reduce the worst cases of slow specs, which should help reduce the frequency of timeouts. There doesn't appear to be much of a benefit for the majority/long tail of tests, however.
Related to #457179 (closed).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
master |
This MR |
---|---|
How to set up and validate locally
If you want to run jest-speed-reporter
yourself locally:
- Clone the project
- Edit its
index.js
to target just the pipeline(s) you want to run it against - Build it with
GITLAB_TOKEN=your_token ./build.sh
- Open
public/index.html
Otherwise, take a look at the pipeline(s) in this MR. Does anything look wrong with Jest jobs, timings or otherwise?