-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Update Jest to latest version, and use optimized JSDOM #53736
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Size Change: 0 B Total Size: 1.51 MB ℹ️ View Unchanged
|
0c35d84 to
e18beb9
Compare
|
Peformance tests are repeatedly failing, the only explanation is that we screwed some packages in the lockfile. I now rebased onto the latest trunk, hoping it helps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great idea to use overrides to benefit immediately from the newer JSDOM 👍
For the protocol, in my local testing (M1 Max), I saw some solid improvement:
this branch:
Run 1: 77.495 s
Run 2: 65.499 s
trunk:
Run 1: 87.772 s
Run 2: 74.769 s
🚀
|
I remember times before when we could execute unit tests in less than 30 seconds 😄 Happy to see that you keep checking how performance can get improved. |
That can always be fixed by removing some tests 😉 When running the unit test suite locally, I see that many warnings and errors are scrolling by as the tests run. That's expected for tests that specifically test for error conditions, but many other warnings probably shouldn't be there. I suspect that many of our tests are half-broken. But not broken enough to make them fail. That could also have some infuence on running times. |
|
In fact, printing to the console might have a bigger impact on the execution time than people would think. We maintain hundreds of test files, and thousands of tests so that takes some time to even log all the test files. |
This PR adds an
overridesfield topackage.jsonto force JSDOM v22 that includes a.getComputedStyleoptimization. This should speed up unit test runs. Although for some reason I don't see convincing results locally, the improvement is from like 50 seconds to 48 seconds, very small. Let's see if CI results are better.I'm also upgrading Jest from 29.5.0 to 29.6.2 in this PR.
npm installfor the changedpackage.jsonwas installing some 29.6.2 dependencies anyway, so I decided to do a proper upgrade.Updating JSDOM to v22 has two other consequences that needed some tests to be fixed:
http://\u001f!\"$&'()*+,-.;=_{}~/"There are very technical reasons, related to TR46 localized domain names, why this URL used to be valid and now no longer is.window.getComputedStylein JSDOM now returns "resolved" color values, i.e.,color: blackis resolved tocolor: rgb(0,0,0). This is the correct behavior, and instances of the.toHaveStylesJest helper need to be updated accordingly.How to test:
The changes affect only unit tests, both web and mobile. There should be no impact on production code.