Skip to content

[code-infra] Add utility to dump html from tests to file#1110

Open
JCQuintas wants to merge 3 commits intomasterfrom
dump-html-utility
Open

[code-infra] Add utility to dump html from tests to file#1110
JCQuintas wants to merge 3 commits intomasterfrom
dump-html-utility

Conversation

@JCQuintas
Copy link
Copy Markdown
Member

Creates a new dumpHTML function in @mui/internal-test-utils

@JCQuintas JCQuintas requested a review from a team February 19, 2026 11:13
@JCQuintas JCQuintas self-assigned this Feb 19, 2026
@JCQuintas JCQuintas added type: new feature Expand the scope of the product to solve a new problem. scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). labels Feb 19, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Feb 19, 2026

Bundle size report

Bundle Parsed size Gzip size
@base-ui-components/react 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

* created inside `test/html-dumps/` using the provided `fileName` (or a timestamp).
* @param options.fileName - Name of the file (without extension) when `filePath` is not set.
*/
export function dumpHTML({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not async ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thought about it, but the sync version can be used in any function, while an async version would need the entire tree to be async.

Since this is to be used just to test and not in regular code, I thought it wasn't necessary for it to be async

* created inside `test/html-dumps/` using the provided `fileName` (or a timestamp).
* @param options.fileName - Name of the file (without extension) when `filePath` is not set.
*/
export function dumpHTML({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggestion: Stay analog to the screen.debug() signature. And avoid conflicting params

await dumpHTML()
await dumpHTML(document.body)
await dumpHTML(document.body, './file.html')
await dumpHTML(screen.getByText('Foo'))
await dumpHTML(screen.getByText('Foo'), './file.html')
await dumpHTML(screen.getByText('Foo'), path.resolve(process.cwd(), './file.html'))

@github-actions
Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Mar 22, 2026
@github-actions github-actions Bot removed the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Apr 3, 2026
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). type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants