Skip to content

Conversation

@LukasTy
Copy link
Member

@LukasTy LukasTy commented Jun 4, 2025

@LukasTy LukasTy self-assigned this Jun 4, 2025
@LukasTy LukasTy 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 Jun 4, 2025
@mui-bot
Copy link

mui-bot commented Jun 4, 2025

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

Bundle size report

Total Size Change: 0B(0.00%) - Total Gzip Change: 0B(0.00%)
Files: 120 total (0 added, 0 removed, 0 changed)

Details of bundle changes

Generated by 🚫 dangerJS against 4465504

@LukasTy LukasTy changed the title Test an even listener reloading page on error [infra] Improve test setup Jun 4, 2025
orchestratorScripts: [
{
id: 'vitest-reload-on-error',
content: `window.addEventListener('vite:preloadError', (event) => { window.location.reload(); });`,
Copy link
Member Author

Choose a reason for hiding this comment

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

@LukasTy LukasTy marked this pull request as ready for review June 4, 2025 15:03
@LukasTy LukasTy requested review from a team and JCQuintas June 4, 2025 15:03
@JCQuintas
Copy link
Member

I suspect these issues are due to OOM/Process/crash of the server. I've created https://github.com/mui/mui-x/pull/18230/files to try to alleviate the problem by using a single browser server to run all tests, rather than the current approach which creates an instance for every package.

In the errors you linked, you see this at the start
Screenshot 2025-06-04 at 17 54 45

Which makes it at least somewhat clear that the server died, and the failure to find the setupVitest file is due to the server not answering vitest.

Which can be seen more towards the end, and it mentions it didn't find it on the server (localhost:xxxx)
Screenshot 2025-06-04 at 17 55 57

@LukasTy LukasTy merged commit c677b1d into mui:master Jun 5, 2025
22 checks passed
@LukasTy LukasTy deleted the try-a-browser-tests-fix branch June 5, 2025 10:24
test: {
name: getTestName(import.meta.url),
environment: 'browser',
setupFiles: [new URL('../../test/utils/setupPickers.js', import.meta.url).pathname],
Copy link
Member

Choose a reason for hiding this comment

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

I'm not 100% sure, but I'd expect this could be broken on windows. Perhaps you want fileURLToPath?

Copy link
Member Author

Choose a reason for hiding this comment

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

We were already using this pattern new URL() in other places. 🤔
Maybe @noraleonte could try running pnpm test:unit:browser to check this assumption? 🙏

Copy link
Member

@Janpot Janpot Jun 18, 2025

Choose a reason for hiding this comment

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

I'd say you always want to use fileURLToPath, even if it works for @noraleonte. Maybe not on your systems, but .pathname is going to give incorrect results. e.g. when someone has their project in a folder with a space or something.

Different case, but I remember someone having their projects in a folder with a dot and this breaking a script that assumes only paths for files can contain a dot. Naturally most people won't have this dot, so the issue remains invisible for a long time and will be hard to debug once it appears. In this case it even affected publishing of stable releases. Conclusion: always use the built-in functions for manipulating urls and paths, even if it looks trivial and seems to work. This is something you can be religious about in my experience.

Copy link
Member Author

Choose a reason for hiding this comment

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

@oliviertassinari oliviertassinari changed the title [infra] Improve test setup [code-infra] Improve test setup Aug 27, 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.

4 participants