styled-components / jest-styled-components

🔧 💅 Jest utilities for Styled Components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jest-styled-components uses global.beforeEach rather than global.beforeAll or both?

JeromeGill opened this issue · comments

This is probably more a question than an issue...

jest-styled-components uses global.beforeEach to reset stylesheets which means in situations where you don't want to remount a component for every test case for whatever reason, you cannot use beforeAll to load it.

Is there a reason jest-styled-components needs to reset stylesheets in beforeEach? If so, is there a reason not to fire it in beforeAll as well?

I believe this should be at the developer's convenience, a beforeAll( ) or via an opt-in option.

Yep. Just got caught out by this too. Any resolution for the bug? Would be a good to have this option to use beforeAll.