Skip to content

Update README.md #9

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,24 @@ Add this in `package.json`:

Enzyme allows you to test React components with DOM support. There are three steps to setting up Enzyme:

1. Install Enzyme, types for Enzyme, a better snapshot serializer for Enzyme, enzyme-adapter-react for your React version:
1. Install Enzyme, types for Enzyme, a better snapshot serializer for Enzyme, enzyme-adapter-react and types for enzyme-adapter-react for your React version:

```sh
yarn add enzyme @types/enzyme enzyme-to-json enzyme-adapter-react-16 --dev
yarn add enzyme @types/enzyme enzyme-to-json enzyme-adapter-react-16 @types/enzyme-adapter-react-16 --dev

# or if you are using NPM
npm i enzyme @types/enzyme enzyme-to-json enzyme-adapter-react-16 -D
npm i enzyme @types/enzyme enzyme-to-json enzyme-adapter-react-16 @types/enzyme-adapter-react-16 -D
```

2. Add "snapshotSerializers" and "setupTestFrameworkScriptFile" to your `jest.config.js`:
2. Add "snapshotSerializers" and "setupFilesAfterEnv" to your `jest.config.js`:

```javascript
module.exports = {
// ... ... ... TRUNCATED. Other parts as before ... ... ...

// Setup Enzyme
"snapshotSerializers": ["enzyme-to-json/serializer"],
"setupTestFrameworkScriptFile": "<rootDir>/src/setupEnzyme.ts",
"setupFilesAfterEnv": ["<rootDir>/src/setupEnzyme.ts"],
}
```

Expand All @@ -147,4 +147,4 @@ import EnzymeAdapter from 'enzyme-adapter-react-16';
configure({ adapter: new EnzymeAdapter() });
```

That's all to it!
That's all to it!