Skip to content

[code-infra] Remove usage of NODE_ENV=test#47692

Open
Janpot wants to merge 10 commits intomui:masterfrom
Janpot:test-env
Open

[code-infra] Remove usage of NODE_ENV=test#47692
Janpot wants to merge 10 commits intomui:masterfrom
Janpot:test-env

Conversation

@Janpot
Copy link
Member

@Janpot Janpot commented Jan 28, 2026

Mandate NODE_ENV to be a binary option production/development. It's being used for tree-shaking purposes, let's not conflate with other concerns. That keeps it easy to reason about.
Where really needed we'll do process.env.NODE_ENV !== 'production' && globalThis.MUI_TEST_ENV.

We use globalThis.MUI_TEST_ENV because it allows us to keep it in the bundle, but not introduce a variable that's not set on the end-user's side. We want it in the bundle because MUI X relies on it as well.

It seems to be mostly used to enable testing some things under jsdom. I'm inclined to make those tests browser-only

@mui-bot
Copy link

mui-bot commented Jan 28, 2026

Netlify deploy preview

https://deploy-preview-47692--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against b27a64a

@Janpot Janpot marked this pull request as ready for review January 28, 2026 21:14
@Janpot Janpot requested a review from a team January 28, 2026 21:14
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jan 29, 2026
@zannager zannager added the scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). label Jan 29, 2026
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jan 30, 2026

if (process.env.NODE_ENV === 'test') {
plugins.push([
'babel-plugin-module-resolver',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be removed from package.json as well

Copy link
Member Author

@Janpot Janpot Feb 2, 2026

Choose a reason for hiding this comment

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

It's seems to still be in use by "coverage" and "development", but I believe we can get rid of these as well, will do as a separate PR as to not conflate concerns.

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).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants