-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[test] Sync regression test layout with Base UI / Material UI #17564
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
Thanks for adding a type label to the PR! 👍 |
634d792
to
e584446
Compare
Deploy preview: https://deploy-preview-17564--material-ui-x.netlify.app/ |
e584446
to
bd67283
Compare
0f97e20
to
e326205
Compare
test/regressions/.mocharc.cjs
Outdated
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.
Wouldn't we want to move towards ESM? I'd bring the changes here to the core instead of the other way around.
Also, right now the e2e & regression setups are close mirrors of each other, if we change one of them we should change both. This applies for .mocharc
, vite.config.js
and package.json
.
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.
Wouldn't we want to move towards ESM?
Yeah, but if you run pnpm run mocha
in HEAD from the /test/regressions
folder, it crash on ESM vs. CJS import conflict, which seems expected since we set "type": "module",
in that folder package but not in the root package. So I think it's a bug fix.
if we change one of them we should change both. This applies for .mocharc, vite.config.js and package.json.
The priority seems reversed, if there is something to copy it's first Base UI or Material UI, and second MUI X.
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.
Why not rename to the file to .mjs
instead then?
The priority seems reversed, if there is something to copy it's first Base UI or Material UI, and second MUI X.
What I meant is that in X, test/regressions
and test/e2e
are very similar. Same file/folder layout, same npm scripts. If we're applying changes to one of those folders, they should be applied to both folders.
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.
In #17214 I tried to move deps & config towards where they're used. Calling the commands such as mocha
from the root means we need all the deps for all the test setups (unit, regressions, e2e) mashed into the root package.json
.
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.
Ok, a variant of this PR: #17583, but I don't really see the value, having the same depends between the different test env seems OK.
'@mui/x-data-grid': path.resolve(import.meta.dirname, '../../packages/x-data-grid/src'), | ||
'@mui/x-data-grid-generator': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-data-grid-generator/src', | ||
), | ||
'@mui/x-data-grid-pro': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-data-grid-pro/src', | ||
), | ||
'@mui/x-data-grid-premium': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-data-grid-premium/src', | ||
), | ||
'@mui/x-date-pickers': path.resolve(import.meta.dirname, '../../packages/x-date-pickers/src'), | ||
'@mui/x-date-pickers-pro': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-date-pickers-pro/src', | ||
), | ||
'@mui/x-charts': path.resolve(import.meta.dirname, '../../packages/x-charts/src'), | ||
'@mui/x-charts-pro': path.resolve(import.meta.dirname, '../../packages/x-charts-pro/src'), | ||
'@mui/x-tree-view': path.resolve(import.meta.dirname, '../../packages/x-tree-view/src'), | ||
'@mui/x-tree-view-pro': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-tree-view-pro/src', | ||
), | ||
'@mui/x-license': path.resolve(import.meta.dirname, '../../packages/x-license/src'), | ||
'@mui/x-telemetry': path.resolve(import.meta.dirname, '../../packages/x-telemetry/src'), | ||
'@mui/x-internals': path.resolve(import.meta.dirname, '../../packages/x-internals/src'), | ||
'@mui/material-nextjs': path.resolve( | ||
import.meta.dirname, | ||
'../../node_modules/@mui/monorepo/packages/mui-material-nextjs/src', | ||
), | ||
docs: path.resolve(import.meta.dirname, '../../node_modules/@mui/monorepo/docs'), |
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.
I have tried to move away from alias lists. If we do want them back, we should probably find a way to avoid having multiple copies of it.
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.
Without this, we have to build the whole project and have it in watch mode to debug/run the visual regression tests, which feels super slow (+200s on my end). Too slow to be usable in practice. #17584
https://github.com/mui/base-ui/blob/a7451a08424f12d913c8355cccf3274ef5f3e055/package.json#L38 or https://github.com/mui/material-ui/blob/a705e1f15075b2deb59263868bfa7b1d9f84cdd4/package.json#L75 seems better.
we should probably find a way to avoid having multiple copies of it.
Oh yeah, once we remove babel alias. I'm not worried about this, I think it's about copying the Base UI repo or Material UI repo. They should get this right. We shouldn't have to think about this in the MUI X repo.
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.
Oh yeah, once we remove babel alias. I'm not worried about this, I think it's about copying the Base UI repo or Material UI repo. They should get this right. We shouldn't have to think about this in the MUI X repo.
Sorry I don't understand what you mean there. Could we create an aliases.js
file at the root to avoid repeating the alias list?
b68d266
to
60a3728
Compare
"private": true, | ||
"type": "module", | ||
"scripts": { |
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.
It seems simpler to have all the actions at the root. I don't actually mind actually, but we might as well copy the references (Base UI, Material UI).
@@ -43,8 +43,11 @@ | |||
"test:e2e": "pnpm run release:build && cd test/e2e && pnpm run start", | |||
"test:e2e-website": "npx playwright test test/e2e-website --config test/e2e-website/playwright.config.ts", | |||
"test:e2e-website:dev": "PLAYWRIGHT_TEST_BASE_URL=http://localhost:3001 npx playwright test test/e2e-website --config test/e2e-website/playwright.config.ts", | |||
"test:regressions": "pnpm run release:build && cd test/regressions && pnpm run start", | |||
"test:regressions:dev": "cd test/regressions && pnpm run start", |
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.
test:regressions:dev doesn't work
"test:regressions:dev": "cd test/regressions && pnpm run start", | ||
"test:regressions": "cross-env NODE_ENV=production pnpm test:regressions:build && concurrently --success first --kill-others \"pnpm test:regressions:run\" \"pnpm test:regressions:server\"", | ||
"test:regressions:build": "cross-env TEST_BUILD=true vite build --config test/regressions/vite.config.js", | ||
"test:regressions:dev": "pnpm test:regressions:build && pnpm test:regressions:server", |
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.
I would want to use this here:
"test:regressions:dev": "pnpm test:regressions:build && pnpm test:regressions:server", | |
"test:regressions:dev": "cross-env TEST_BUILD=true vite --config test/regressions/vite.config.js --port 5001", |
but Vite seems unable to build properly in dev mode compared to webpack, so falling back to this 🙃. Sad, I don't understand.
'@mui/x-data-grid': path.resolve(import.meta.dirname, '../../packages/x-data-grid/src'), | ||
'@mui/x-data-grid-generator': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-data-grid-generator/src', | ||
), | ||
'@mui/x-data-grid-pro': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-data-grid-pro/src', | ||
), | ||
'@mui/x-data-grid-premium': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-data-grid-premium/src', | ||
), | ||
'@mui/x-date-pickers': path.resolve(import.meta.dirname, '../../packages/x-date-pickers/src'), | ||
'@mui/x-date-pickers-pro': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-date-pickers-pro/src', | ||
), | ||
'@mui/x-charts': path.resolve(import.meta.dirname, '../../packages/x-charts/src'), | ||
'@mui/x-charts-pro': path.resolve(import.meta.dirname, '../../packages/x-charts-pro/src'), | ||
'@mui/x-tree-view': path.resolve(import.meta.dirname, '../../packages/x-tree-view/src'), | ||
'@mui/x-tree-view-pro': path.resolve( | ||
import.meta.dirname, | ||
'../../packages/x-tree-view-pro/src', | ||
), | ||
'@mui/x-license': path.resolve(import.meta.dirname, '../../packages/x-license/src'), | ||
'@mui/x-telemetry': path.resolve(import.meta.dirname, '../../packages/x-telemetry/src'), | ||
'@mui/x-internals': path.resolve(import.meta.dirname, '../../packages/x-internals/src'), | ||
'@mui/material-nextjs': path.resolve( | ||
import.meta.dirname, | ||
'../../node_modules/@mui/monorepo/packages/mui-material-nextjs/src', | ||
), | ||
docs: path.resolve(import.meta.dirname, '../../node_modules/@mui/monorepo/docs'), |
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.
Without this, we have to build the whole project and have it in watch mode to debug/run the visual regression tests, which feels super slow (+200s on my end). Too slow to be usable in practice. #17584
https://github.com/mui/base-ui/blob/a7451a08424f12d913c8355cccf3274ef5f3e055/package.json#L38 or https://github.com/mui/material-ui/blob/a705e1f15075b2deb59263868bfa7b1d9f84cdd4/package.json#L75 seems better.
we should probably find a way to avoid having multiple copies of it.
Oh yeah, once we remove babel alias. I'm not worried about this, I think it's about copying the Base UI repo or Material UI repo. They should get this right. We shouldn't have to think about this in the MUI X repo.
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.
Ok, a variant of this PR: #17583, but I don't really see the value, having the same depends between the different test env seems OK.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has been inactive for 30 days. Please remove the stale label or leave a comment to keep it open. Otherwise, it will be closed in 15 days. |
This pull request has been closed due to 15 days of inactivity after being marked stale. |
I wanted to run the regression tests in dev mode to debug #17538.
But since #17214, it's no longer possible. I'm bringing this back, progressively making Base UI the gold reference (rather than Material UI) for code-infra.