Skip to content

Conversation

@Janpot
Copy link
Member

@Janpot Janpot commented Nov 13, 2025

Locally, these were some of the slowest tests. There are few problems with them:

  1. resolution of catalog: version was wrong. We corrected the behavior for babel runtime in our build tooling, bringing that fix here. catalog: is a version range and it's set in the pnpm config. We should just fetch that version range from the catalog and pretend that's what was set in package.json. No need to resolve it if we also don't do that for the non catalog: variant of this test.
  2. it was using npm in one of its commands instead of pnpm
  3. using blocking io for no reason, let's not assume the test runtime doesn't want timers to fire for several seconds.
  4. we can memoize the expensive catalog fetching for all versions of this test. No need to re-execute it every time. It's a reasonable expectation that the tests will be restarted if the catalog changes.
  5. What is this test testing anyway? whether pnpm install has been run or something? Personally I'd remove this test altogether, but with these fixes it should be fast enough so up to the team.
  6. Exclude these tests from the browser config to avoid tryign to bundle execa and blowing up

Locally I had 9 of those tests in my top-20 leaderboard of slowest tests, after these changes there were none. Overall time went down by 18s but I'm, not sure how stable the overall runtime is

@Janpot Janpot added test type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). labels Nov 13, 2025
@mui-bot
Copy link

mui-bot commented Nov 13, 2025

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

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 9a4dd7a

@Janpot Janpot marked this pull request as ready for review November 13, 2025 11:52
@Janpot Janpot requested review from a team and JCQuintas November 13, 2025 11:53
defineConfig({
test: {
name: getTestName(import.meta.url),
exclude: ['**/materialVersion.test.tsx'],
Copy link
Member

Choose a reason for hiding this comment

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

Cant we put this in vitest.config.mts based on process.env.BROWSER?

Copy link
Member Author

@Janpot Janpot Nov 13, 2025

Choose a reason for hiding this comment

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

imo we shouldn't use this variable for anything else than moving config from cli to your script. as soon as it is read and parsed, use that js value and distribute with regular JavaScript constructs. better to create a factory function for your config and pass a browser boolean to it. this is ensures all logic is encoded in regular program flow and is easier to debug and reason about. if you disagree let me know, otherwise I'll look into it in a separate PR

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, you can do whatever with the variable, my point was more to move the logic to single place.

@Janpot Janpot merged commit 789d239 into mui:master Nov 13, 2025
21 checks passed
bernardobelchior added a commit to bernardobelchior/mui-x that referenced this pull request Nov 19, 2025
mapache-salvaje pushed a commit to mapache-salvaje/mui-x that referenced this pull request Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). test type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants