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

Test setup #1

Merged
merged 8 commits into from
Nov 20, 2017
Merged

Test setup #1

merged 8 commits into from
Nov 20, 2017

Conversation

brunolm
Copy link
Owner

@brunolm brunolm commented Nov 20, 2017

Tests

Packages

Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output.

RAF requestAnimationFrame polyfill for node and the browser.

npm i -D raf enzyme enzyme-adapter-react-16 @types/enzyme @types/enzyme-adapter-react-16

Test setup file

create-react-app by default loads src/setupTests file with jest.

Enzyme needs to be configured with an adapter and raf polyfills need to be loaded.

import 'raf/polyfill';

import * as Adapter from 'enzyme-adapter-react-16';
import { configure } from 'enzyme';

configure({ adapter: new Adapter() });

```
npm i -D enzyme enzyme-adapter-react-16 @types/enzyme @types/enzyme-adapter-react-16
```
By default this is the file create-react-app reads to setup tests
@brunolm brunolm merged commit 0b6e526 into master Nov 20, 2017
@brunolm brunolm deleted the test-setup branch November 20, 2017 00:56
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

Successfully merging this pull request may close these issues.

1 participant