jest-styled-components icon indicating copy to clipboard operation
jest-styled-components copied to clipboard

Different outcomes with different NODE_ENV values

Open oleksii-kachura opened this issue 6 years ago • 1 comments

Running Jest tests with NODE_ENV=test gives different result vs running them with NODE_ENV=production

Example snapshot difference when changing from production to test

      .c7 {
    -   font-weight: 600;
    +   font-weight: normal;
    -   padding: 0 20px;
    -   background-color: #00539f;
    +   padding: 0;
    +   background-color: transparent;
    +   font-weight: 600;
    +   padding: 0 20px;
    +   background-color: #00539f;
      }

This is how I run the test

import { render } from '@testing-library/react'
import Component from '.'

it('renders correctly', () => {
    const { asFragment } = render(<Component />)
    const component = asFragment()
    expect(component).toMatchSnapshot()
})

Versions:

[email protected]
@testing-library/[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

oleksii-kachura avatar Nov 28 '19 14:11 oleksii-kachura

I'm experiencing the same issue. Has this issue ever been addressed?

Diff:

.c0 {
  font-size: 1rem;
-   line-height: 1.375rem;
-   display: inline-block;
    line-height: var(--spacing-6);
+   display: inline-block;
    width: calc(100% - var(--spacing-6));
}

Versions:

yarn list v1.22.19
├─ [email protected]
└─ [email protected]

barmatz avatar Nov 28 '23 11:11 barmatz