Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Added react-test-renderer dependency #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ Enzyme is similar, but builds on jsdom and makes it easier to make certain queri
Let's install it as a development-time dependency.

```sh
npm install -D enzyme @types/enzyme react-addons-test-utils
npm install -D enzyme @types/enzyme react-addons-test-utils react-test-renderer
```

Notice we installed packages `enzyme` as well as `@types/enzyme`.
The `enzyme` package refers to the package containing JavaScript code that actually gets run, while `@types/enzyme` is a package that contains declaration files (`.d.ts` files) so that TypeScript can understand how you can use Enzyme.
You can learn more about `@types` packages [here](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).

We also had to install `react-addons-test-utils`.
This is something `enzyme` expects to be installed.
We also had to install `react-addons-test-utils` and `react-test-renderer`.
These are things `enzyme` expects to be installed.

Now that we've got Enzyme set up, let's start writing our test!
Let's create a file named `src/components/Hello.test.tsx`, adjacent to our `Hello.tsx` file from earlier.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"private": true,
"devDependencies": {
"react-addons-test-utils": "^15.4.2",
"react-scripts-ts": "1.0.6"
"react-scripts-ts": "1.0.6",
"react-test-renderer": "^15.5.4"
},
"dependencies": {
"@types/enzyme": "^2.7.2",
Expand Down