Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cache transforms within a worker #8890

Merged
merged 3 commits into from Sep 8, 2019
Merged

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Aug 30, 2019

Summary

May or may not fix #7811, but it looks pretty good!


Due to the changes in #7186, we no longer cached transformed files between tests within a single worker. Not sure why, but we get a cache miss in the weakmap. Anyone has any good ideas?

@rafeca I realise you don't work at FB aymore, but FYI just in case you remember some context or have any comments 馃檪

Test plan

Added test. Without the changes in ScriptTransformer, this is the result of the new test:

image

(I've since tweaked this test to work on Windows, but it's still essentially accurate)

Config.ProjectConfig,
ProjectCache
> = new WeakMap();
const projectCaches = new Map<string, ProjectCache>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not the correct fix, but with this change the tests pass at least, which is a good start 馃檪

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this is alright.

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-io
Copy link

codecov-io commented Aug 30, 2019

Codecov Report

Merging #8890 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8890      +/-   ##
==========================================
+ Coverage   64.24%   64.24%   +<.01%     
==========================================
  Files         275      275              
  Lines       11656    11657       +1     
  Branches     2844     2844              
==========================================
+ Hits         7488     7489       +1     
  Misses       3544     3544              
  Partials      624      624
Impacted Files Coverage 螖
packages/jest-transform/src/ScriptTransformer.ts 68.91% <100%> (+0.14%) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 5545730...b854854. Read the comment docs.

Copy link
Contributor

@jeysal jeysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this will have the desired effect 馃檹

Copy link
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipit!

@SimenB
Copy link
Member Author

SimenB commented Sep 2, 2019

repo checkout timed out on azure, and everything passed before merging in master, so the failure is w/e.

@scotthovestadt could you test this at FB and merge+release if it looks OK? 馃檪

@thymikee thymikee merged commit 04efbeb into jestjs:master Sep 8, 2019
@thymikee
Copy link
Collaborator

thymikee commented Sep 8, 2019

Let's have this merged already, as folks reportedly come back with better results. @scotthovestadt feel free to test the latest master then :)

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jest 24 is slower than Jest 23.6.0 on the same test suite
6 participants