This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
Global test functions in setupTests.ts #352
Closed
Description
Is it possible to write a function in the src/setupTest.ts
file that will be available in every test file?
For example, I want to write a react-intl
helper that I can use when testing components. I have the following code:
// src/setupTests.ts
import { createIntlWrapper } from 'test-utils/react/react-intl';
import enMessages from './assets/locales/en.json';
const wrapIntl = createIntlWrapper('en', enMessages);
The createIntlWrapper
returns a function which mimic this helper function.
When I need to test components that have react-intl components, I want to be able to wrap the JSX with wrapIntl(<SampleComponent />)
without importing the code above in every file.
Metadata
Metadata
Assignees
Labels
No labels