Posts
Members
Info
React Testing Library, getByRole and media queries
When running tests that use the RTL getByRole query, elements that are hidden by default but have a media query to make them visible do not get included unless I explicitly tell RTL to include hidden elements, even though the jest screen size when running tests would trigger the…
0
Deleted·2y# jest
<StyledHeading /> is using incorrect casing. Use PascalCase for React…
When I use yarn test to test my styled-components powered React component then I get following warning - Warning: <StyledHeading /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements. This happens when I separated out styled-components…
5
Seeing duplicate elements logged in tests when using Enzyme's mount
In a CRA project, I have a Header component defined and used like so: When using Enzyme's mount and find to target the data-test-ids, my tests fail because find returns two nodes. This is the output when logging via console.log(wrapper.debug()): I can't tell if this is a CRA,…
0
I can't mount with context after upgrading to react 16.6 and Styled Components…
I'm trying to run test with enzyme and I need to render some components which use properties from my global theme. Before I had to do something like But I noticed that getChildContext is not a function anymore so I thought about switching to this …
14
Testing createGlobalStyle in v5
Hi! I am building a component library which has a component for global styles. In v4, the component was tested as follows: GlobalStyles …
0
css.parse is not a function
I've been getting this error whenever testing with jest-styled-components. To combat this with v4, I made a fork that fixes the import culprit: https://github.com/dmitrizzle/jest-styled-components/blob/master/src/utils.js#L1 Basically, Node seems to be failing to follow the…
0
I've updated to styled-components v5 beta and my jest-styled-components breaks
I've recently update my codebase to use the beta v5 of styled-components and my entire test-suite fails now! I'm using jest-styled-components which was working fine until today and now I'm getting the error Could neither find styled-components secret internals nor…
2