Skip to content

[styles] Improve Jest snapshot testing#14358

Closed
jesusmaldonado wants to merge 1 commit into
mui:masterfrom
jesusmaldonado:removes_counter_testing
Closed

[styles] Improve Jest snapshot testing#14358
jesusmaldonado wants to merge 1 commit into
mui:masterfrom
jesusmaldonado:removes_counter_testing

Conversation

@jesusmaldonado

@jesusmaldonado jesusmaldonado commented Jan 31, 2019

Copy link
Copy Markdown

Closes #14357

@jesusmaldonado jesusmaldonado changed the title [WithStyles] Remove counter functionality when in test environment (#… [WithStyles] Remove counter functionality when in test environment Jan 31, 2019
@jesusmaldonado
jesusmaldonado force-pushed the removes_counter_testing branch from d43443a to 121b448 Compare January 31, 2019 01:40

// For testing, MUI produces duplicate results for Snapshots

if (process.env.NODE_ENV === 'test') {

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.

What do you think of this change instead:

-const { dangerouslyUseGlobalCSS = false, productionPrefix = 'jss', seed = '' } = options;
+const { dangerouslyUseGlobalCSS = process.env.NODE_ENV === 'test', productionPrefix = 'jss', seed = '' } = options;

@oliviertassinari oliviertassinari changed the title [WithStyles] Remove counter functionality when in test environment [styles] Improve Jest snapshot testing Jan 31, 2019
@oliviertassinari oliviertassinari added test scope: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. labels Jan 31, 2019
@oliviertassinari

Copy link
Copy Markdown
Member

I'm closing, for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snapshotting logic does not provide an adequate className in a testing environment.

2 participants