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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Lock jsdom version #11652

Merged
merged 2 commits into from
Jan 11, 2024
Merged

Conversation

cherniavskii
Copy link
Member

After merging #11303 I noticed that our CI pipeline became slower:

The difference is coming from the test:unit step:

Before After
Screenshot 2024-01-11 at 01 04 17

Turns out, there was a CSS selector engine change in jsdom that causes a performance regression - see https://github.com/jsdom/jsdom/releases/tag/23.2.0

I've locked the jsdom version for now.

@cherniavskii cherniavskii added test core Infrastructure work going on behind the scenes labels Jan 11, 2024
@mui-bot
Copy link

mui-bot commented Jan 11, 2024

Deploy preview: https://deploy-preview-11652--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 62e6481

@cherniavskii
Copy link
Member Author

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Nice observation! 💙
Do you know if renovate won't try bumping a direct dep version? 🤔

Also, there's something wrong with our setup - the Core repo runs twice the number of tests in less time

I'd say that in this case we are trying to compare apples to oranges.
The components in core repo are way lighter, easier and thus faster to render, don;t you think? 🤔

@cherniavskii
Copy link
Member Author

Do you know if renovate won't try bumping a direct dep version? 🤔

Good point, I think it would try bumping the version according to https://docs.renovatebot.com/getting-started/use-cases/#package-managers-with-lock-files
I'll address this 👍🏻

@cherniavskii
Copy link
Member Author

The components in core repo are way lighter, easier and thus faster to render, don;t you think? 🤔

You're right 👍🏻 I thought this could be a reason that explains why tests in jsdom are slower than tests in real browsers, but it's not 🙃

So the question remains - how come tests in jsdom are slower that tests in real browser? The whole point of jsdom is that it is supposed to be a "lightweight browser" that runs tests faster 😅

@LukasTy
Copy link
Member

LukasTy commented Jan 11, 2024

So the question remains - how come tests in jsdom are slower that tests in real browser? The whole point of jsdom is that it is supposed to be a "lightweight browser" that runs tests faster 😅

Well, that is a good question indeed. 💡
Maybe it could be due to how we write tests - AFAIK, preferring accessible getters (mostly getByRole) is way slower than just getByText or especially getByTestId.
Should it be slower than an actual headless browser? 🤔 Hell no, that doesn't make sense... In such a case, it's better to write as few unit tests and as many "e2e" tests run in a browser. 🤷

@flaviendelangle
Copy link
Member

So the question remains - how come tests in jsdom are slower that tests in real browser? The whole point of jsdom is that it is supposed to be a "lightweight browser" that runs tests faster

My hypothesis is that JSDoc is a lot lighter to get running, so the simplest test will be waaaaaay faster.
But it does not have all the complex optimization of a real browser so when the DOM structure becomes more complex and the selectors more advanced it looses ground.

I don't have any numbers to back it up though

@cherniavskii cherniavskii merged commit 09a24de into mui:next Jan 11, 2024
17 checks passed
@cherniavskii cherniavskii deleted the lock-jsdom-version branch January 11, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants