Skip to content

[code-infra] Migrate regression tests to vite #44964

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

Merged
merged 37 commits into from
Mar 25, 2025
Merged

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Jan 7, 2025

Avoid React.lazy, I don't feel like it brings a lot of benefit here as we're running through all the fixtures anyway and it causes throttled fallbacks in the suspense boundary.

If the blacklist is too big, this may cause a lot of overhead in the bundle. Alternative would be to generate a virtual module that re-exports all desired fixtures and no more.

just migrate regression tests to vite so we can encode the blacklist in the glob and avoid them in the bundle altogether

blocked on #44976

screenshot generation seems to run about ~30s (~15%) faster now

1 failing screenshot in joy theme viewer, caused by vitejs/vite#13727. We can ignore this for now

@Janpot Janpot added test scope: code-infra Specific to the core-infra product labels Jan 7, 2025
@mui-bot
Copy link

mui-bot commented Jan 7, 2025

Netlify deploy preview

https://deploy-preview-44964--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 35e61ee

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 8, 2025
@mj12albert
Copy link
Member

Recently swapped out webpack for vite in the e2e/regressions setup here too 😬
mui/base-ui#1127

@Janpot
Copy link
Member Author

Janpot commented Jan 17, 2025

Yep, this is at the moment blocked on an update that removes some commonjs imports from the docs, which in turn is blocked on upgrading monorepo in X.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 23, 2025
@Janpot Janpot changed the title [code-infra] Remove lazy require.context from regression tests [code-infra] Migrate regression tests to vite Mar 24, 2025
@Janpot Janpot marked this pull request as ready for review March 24, 2025 17:08
@Janpot Janpot requested a review from a team March 24, 2025 17:09
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 24, 2025
Comment on lines 47 to 52
const importDemos = import.meta.glob(
[
'docs/data/**/[A-Z]*.js',
'docs/data/base/**/[A-Z]*/css/index.js',
'docs/data/base/**/[A-Z]*/tailwind/index.js',
'docs/data/base/**/[A-Z]*/system/index.js',
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to comment mentioning this is a include globs followed by exclude globs 😅

Copy link
Member

Choose a reason for hiding this comment

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

Great point, since now those are combined. 💡

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 did another pass over this patterns list and cleaned it up, sorted alphabetically and added a comment deliniating the inclusions from the exclusions

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 evolution, great job! 👏 💯

Nitpick: Have you tried vite v5? 🤔
Currently all other deps are bringing/expecting vite v5 and with this change we introduce a new major of vite.

Comment on lines 47 to 52
const importDemos = import.meta.glob(
[
'docs/data/**/[A-Z]*.js',
'docs/data/base/**/[A-Z]*/css/index.js',
'docs/data/base/**/[A-Z]*/tailwind/index.js',
'docs/data/base/**/[A-Z]*/system/index.js',
Copy link
Member

Choose a reason for hiding this comment

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

Great point, since now those are combined. 💡

export default defineConfig({
plugins: [
{
// Unfortunatelly necessary as we opted to write our jsx in js files
Copy link
Member

Choose a reason for hiding this comment

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

🙈 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

It's on my to do list. This has been causing trouble every time we try to introduce a tool that relies on esbuild.

@Janpot
Copy link
Member Author

Janpot commented Mar 25, 2025

Currently all other deps are bringing/expecting vite v5 and with this change we introduce a new major of vite.

I may be checking this wrong, but the only thing I see bringing in vite 5 is @app/pigment-css-vite-app, I also see the bundler tests bringing vite 4. I don't think it's a problem. The bundler test needs an update, and @app/pigment-css-vite-app needs to move to the pigment repository

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 25, 2025
@Janpot Janpot merged commit d8aa7fc into mui:master Mar 25, 2025
22 checks passed
@Janpot Janpot mentioned this pull request Mar 31, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: code-infra Specific to the core-infra product test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants