Jest cache restoring with parallel steps

If I’m running tests in parallel (x3, let’s say), can I also restore / save jest’s cache step, or will I run into weird corruption or other issues. I noticed in testing that jest runs much faster when the cache is present, and came across this post:

However, it’s unclear what will happen when multiple jobs (especially parallel ones) are reading from / saving to the same cache.

Also, has anyone taken this approach when using react-scripts test specifically? Last I checked, it wasn’t clear if the cache directory parameter could be passed through to it.

1 Like