From 5598e2397e071eb3235972adadf87b2c06e6f700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Tue, 9 Jul 2019 14:35:52 +0200 Subject: [PATCH] Update npm package names --- docusaurus/docs/running-tests.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md index e166c71dfd0..45dcdba8059 100644 --- a/docusaurus/docs/running-tests.md +++ b/docusaurus/docs/running-tests.md @@ -175,18 +175,18 @@ import 'jest-enzyme'; ### Option 2: React Testing Library -As an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/gnapse/jest-dom) for improved assertions. +As an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/testing-library/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/testing-library/jest-dom) for improved assertions. To install `react-testing-library` and `jest-dom`, you can run: ```sh -npm install --save @testing-library/react jest-dom +npm install --save @testing-library/react @testing-library/jest-dom ``` Alternatively you may use `yarn`: ```sh -yarn add @testing-library/react jest-dom +yarn add @testing-library/react @testing-library/jest-dom ``` Similar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerplate in your test files: @@ -196,7 +196,7 @@ Similar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerpla // this will ensure they're removed after each test. import '@testing-library/react/cleanup-after-each'; // this adds jest-dom's custom assertions -import 'jest-dom/extend-expect'; +import '@testing-library/jest-dom/extend-expect'; ``` Here's an example of using `react-testing-library` and `jest-dom` for testing that the `` component renders "Welcome to React".