Skip to content

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