Skip to content

Instantly share code, notes, and snippets.

@mauriciomutte
Last active May 7, 2021 00:31
Show Gist options
  • Save mauriciomutte/ad3b4425751f38c8cf3da525fa5356a9 to your computer and use it in GitHub Desktop.
Save mauriciomutte/ad3b4425751f38c8cf3da525fa5356a9 to your computer and use it in GitHub Desktop.
Testing-library + styled-components + Typescript
import { ReactElement } from 'react';
import { ThemeProvider } from 'styled-components';
import { render, RenderOptions } from '@testing-library/react';
import theme from 'styles/theme';
type CustomRenderProps = Omit<RenderOptions, 'queries'>;
const customRender = (ui: ReactElement, options: CustomRenderProps = {}) =>
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>, options);
export * from '@testing-library/react';
export { customRender as render };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment