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

setupTests.js import "jest-styled-components" not working #20

Closed
ChefHutch opened this issue Mar 18, 2021 · 1 comment
Closed

setupTests.js import "jest-styled-components" not working #20

ChefHutch opened this issue Mar 18, 2021 · 1 comment

Comments

@ChefHutch
Copy link
Contributor

Our import of "jest-styled-components" in setupTests.js doesn't seem to be working. Without snapshots capturing styles, they aren't much good.

As detailed here https://github.com/styled-components/jest-styled-components#snapshot-testing, we'd expect our snapshots to capture styles, and have placeholder classNames rather than hashed classnames (which will change on every style update). i.e.

// breadcrumbs.test.tsx
      .c0 {
      -webkit-align-items: center;
      -webkit-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      color: #BDC2C4;
      display: -webkit-box;
      display: -webkit-flex;
      display: -ms-flexbox;
      display: flex;
      -webkit-flex-wrap: wrap;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      list-style-type: none;
    }

    <ul
        class="c0"
      />

But, instead, our snapshots are missing styles and have hashed classnames, i.e.

// breadcrumbs.test.tsx

     <ul
        class="sc-dlfnbm lhEQuh"
      />
@Chef-Cheems
Copy link
Contributor

I believe this is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants