Skip to content
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

[code-infra] Remove deprecated data-mui-test in favour of data-testid #14882

Merged
merged 7 commits into from
Oct 9, 2024

Conversation

JCQuintas
Copy link
Member

Preparing for #14508, removing deprecated apis usage

@JCQuintas JCQuintas added the scope: code-infra Specific to the core-infra product label Oct 8, 2024
@JCQuintas JCQuintas self-assigned this Oct 8, 2024
@mui-bot
Copy link

mui-bot commented Oct 8, 2024

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

Generated by 🚫 dangerJS against 139d9a0

Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

If you can wait for the alpha, I'm in favor of dropping those from the pickers
We don't add them to any new element an nobody ever asked for them on the pickers

@JCQuintas
Copy link
Member Author

Why wait for the alpha? These are completely removed from the build by a plugin. They exist solely in our codebase afaik

@flaviendelangle
Copy link
Member

Why wait for the alpha? These are completely removed from the build by a plugin. They exist solely in our codebase afaik

No build we publish have them?
In that case we can just drop them indeed, we might have a few old tests to migrate

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 improvement! 👍
Never understood the reason for that custom query... 🤷 🙈

@@ -129,7 +125,9 @@ module.exports = function getBabelConfig(api) {
}

if (process.env.NODE_ENV === 'production') {
plugins.push(...productionPlugins);
if (!process.env.E2E_BUILD) {
plugins.push(['babel-plugin-react-remove-properties', { properties: ['data-testid'] }]);
Copy link
Member

Choose a reason for hiding this comment

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

What causes this to suddenly be necessary? If possible, would be nice to keep parity between babel configs across repos. With the hope of some day just embedding it in our build tooling.

Copy link
Member Author

Choose a reason for hiding this comment

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

e2e tests build the source-code using this configuration and they rely on the data-testid

If this plugin is enabled they simply don't work.

Copy link
Member Author

Choose a reason for hiding this comment

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

For more context, previously it wasn't an issue because in unit tests we were using data-mui-test but e2e were using data-testid, so the data-mui-test could be removed regardless of build.

But since now both use data-testid, the issue appears

Copy link
Member

Choose a reason for hiding this comment

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

interestingly, this rename in core was done without altering the babel config mui/material-ui#23498

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed material doesn't remove the data-testid from the build, that is why they don't have this problem.

But most of the times they add data-testid in the test themselves, not the source code.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants