-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
[icons] Remove SvgIcon data-testid in production #45333
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
Netlify deploy preview
@material-ui/core: parsed: -0.07% 😍, gzip: -0.13% 😍 Bundle size reportDetails of bundle changes (Toolpad) |
|
Terrible! Terrible folks! What on earth are y folks doing over there? |
@EfstathiadisD Trimming unnecessary bloat from production code, these test ids end up in server rendered html and potentially clash with user defined test ids. The component still spreads props on the svg element, so a user defined testid will still end up there. Wouldn't that suffice for your use-case? Could you elaborate a bit more on why you think this should be kept? |
It was one of the most efficient ways to write tests! We all had 1 way to test them, and now people are gonna start renaming it how they like. I think options hurt the ecosystem more than strictness. I understand that it might not be beneficial but consider an approach where this Icons can have predefined data-testId. Like a flag or something. And I suppose this goes to V7 as a breaking change. In our repo it about 35 instances of this. And our apps aren't huge! Just IMHO! |
Would it work for you if we add the test id only when |
I think this is a good compromise, I can't imagine anyone wanting to have these in production. |
Yeah. That makes lots of sense! Thank You!!🙏 |
|
Hello! Removing it only for production is very confusing because if you run e2e tests with the production version as we do you might have your tests running locally when implementing them, because you use the dev version, but have your tests fail in CI that uses the prod version. If you forget about this point you might have to wait for the CI to finish to figure out the issue. This also makes debugging very difficult unless you're aware of this subtlety. Is it possible to add some flag to opt out of removing the test-id? |
Many companies use |
Removes the default
data-testidprop when in production. Adds a section to the migration guide and remove the docs that describe this behavior.