Skip to content

Commit 4130a14

Browse files
committed
Upgrades deps including react-testing-library to @testing-library/react
1 parent 0a10ab1 commit 4130a14

File tree

6 files changed

+60
-41
lines changed

6 files changed

+60
-41
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ test('fetchById', async () => {
18211821
<summary>Testing components</summary>
18221822
<p>
18231823
1824-
When testing your components I strongly recommend the approach recommended by Kent C. Dodd's awesome [Testing Javascript](https://testingjavascript.com/) course, where you try to test the behaviour of your components using a natural DOM API, rather than reaching into the internals of your components. He has published a very useful package by the name of [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) to help us do so. The tests below shall be adopting this package and strategy.
1824+
When testing your components I strongly recommend the approach recommended by Kent C. Dodd's awesome [Testing Javascript](https://testingjavascript.com/) course, where you try to test the behaviour of your components using a natural DOM API, rather than reaching into the internals of your components. He has published a very useful package by the name of [`@testing-library/react`](https://github.com/testing-library/react-testing-library) to help us do so. The tests below shall be adopting this package and strategy.
18251825
18261826
Imagine we were trying to test the following component.
18271827

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"@babel/preset-react": "^7.0.0",
6767
"@babel/preset-typescript": "^7.3.3",
6868
"@babel/register": "^7.4.4",
69+
"@testing-library/react": "^8.0.1",
6970
"@types/react": "^16.8.19",
7071
"@types/react-dom": "^16.8.4",
7172
"@types/react-redux": "^7.0.9",
@@ -92,13 +93,12 @@
9293
"react": "^16.8.3",
9394
"react-dom": "^16.8.3",
9495
"react-redux": "^7.0.3",
95-
"react-testing-library": "^7.0.1",
9696
"rimraf": "^2.6.2",
97-
"rollup": "^1.12.5",
97+
"rollup": "^1.13.1",
9898
"rollup-plugin-babel": "^4.3.1",
9999
"rollup-plugin-commonjs": "^10.0.0",
100100
"rollup-plugin-filesize": "^6.1.0",
101-
"rollup-plugin-node-resolve": "^5.0.0",
101+
"rollup-plugin-node-resolve": "^5.0.1",
102102
"rollup-plugin-replace": "^2.2.0",
103103
"rollup-plugin-uglify": "^6.0.2",
104104
"typescript": "3.5.1",
@@ -110,7 +110,7 @@
110110
],
111111
"setupFilesAfterEnv": [
112112
"<rootDir>/node_modules/regenerator-runtime/runtime",
113-
"react-testing-library/cleanup-after-each",
113+
"@testing-library/react/cleanup-after-each",
114114
"jest-dom/extend-expect"
115115
],
116116
"testMatch": [

src/__tests__/react.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import React from 'react';
55
import { act } from 'react-dom/test-utils';
6-
import { render, fireEvent } from 'react-testing-library';
6+
import { render, fireEvent } from '@testing-library/react';
77

88
import {
99
action,

src/__tests__/testing/react.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, fireEvent } from 'react-testing-library';
2+
import { render, fireEvent } from '@testing-library/react';
33
import {
44
action,
55
createStore,

src/__tests__/use-store.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import React from 'react';
44
import { act } from 'react-dom/test-utils';
5-
import { render, fireEvent } from 'react-testing-library';
5+
import { render, fireEvent } from '@testing-library/react';
66

77
import {
88
action,

yarn.lock

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,13 @@
830830
dependencies:
831831
regenerator-runtime "^0.13.2"
832832

833+
"@babel/runtime@^7.4.5":
834+
version "7.4.5"
835+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12"
836+
integrity sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==
837+
dependencies:
838+
regenerator-runtime "^0.13.2"
839+
833840
"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.2.2", "@babel/template@^7.4.0":
834841
version "7.4.0"
835842
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.0.tgz#12474e9c077bae585c5d835a95c0b0b790c25c8b"
@@ -1077,6 +1084,24 @@
10771084
resolved "https://registry.yarnpkg.com/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz#8013f2af54a2b7d735f71560ff360d3a8176a87b"
10781085
integrity sha512-vTCdPp/T/Q3oSqwHmZ5Kpa9oI7iLtGl3RQaA/NyLHikvcrPxACkkKVr/XzkSPJWXHRhKGzVvb0urJsbMlRxi1Q==
10791086

1087+
"@testing-library/dom@^5.0.0":
1088+
version "5.1.1"
1089+
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-5.1.1.tgz#091a30b1ca058080bf432cd1aeb2b7c646022f97"
1090+
integrity sha512-twpAkqomsI0xeOLehijOAmPxeKvs6+WZC/6/nXD0+HNQupP3OZeZho/PBlNhrGL+8nQWiPjdvmxeyU0tq+hctA==
1091+
dependencies:
1092+
"@babel/runtime" "^7.4.5"
1093+
"@sheerun/mutationobserver-shim" "^0.3.2"
1094+
pretty-format "^24.8.0"
1095+
wait-for-expect "^1.2.0"
1096+
1097+
"@testing-library/react@^8.0.1":
1098+
version "8.0.1"
1099+
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-8.0.1.tgz#91c254adf855b13de50020613cb5d3915f9f7875"
1100+
integrity sha512-N/1pJfhEnNYkGyxuw4xbp03evaS0z/CT8o0QgTfJqGlukAcU15xf9uU1w03NHKZJcU69nOCBAoAkXHtHzYwMbg==
1101+
dependencies:
1102+
"@babel/runtime" "^7.4.5"
1103+
"@testing-library/dom" "^5.0.0"
1104+
10801105
"@types/babel__core@^7.1.0":
10811106
version "7.1.0"
10821107
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51"
@@ -2348,16 +2373,6 @@ doctrine@^3.0.0:
23482373
dependencies:
23492374
esutils "^2.0.2"
23502375

2351-
dom-testing-library@^4.1.0:
2352-
version "4.1.0"
2353-
resolved "https://registry.yarnpkg.com/dom-testing-library/-/dom-testing-library-4.1.0.tgz#273264e62e9e63f4e404f7349ddd7b9356aacd23"
2354-
integrity sha512-654GHd0oPC31S+ll1bJH9NUOBRzcHcrf23/XzJh41o6g67uGUpF9tn23qmbcwjNauoRqKQfAdHCDwr/Ez/Ot7A==
2355-
dependencies:
2356-
"@babel/runtime" "^7.4.3"
2357-
"@sheerun/mutationobserver-shim" "^0.3.2"
2358-
pretty-format "^24.7.0"
2359-
wait-for-expect "^1.1.1"
2360-
23612376
domexception@^1.0.1:
23622377
version "1.0.1"
23632378
resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90"
@@ -2739,6 +2754,11 @@ estree-walker@^0.6.0:
27392754
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae"
27402755
integrity sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw==
27412756

2757+
estree-walker@^0.6.1:
2758+
version "0.6.1"
2759+
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
2760+
integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
2761+
27422762
esutils@^2.0.0, esutils@^2.0.2:
27432763
version "2.0.2"
27442764
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
@@ -5644,7 +5664,7 @@ pretty-format@^24.0.0:
56445664
ansi-styles "^3.2.0"
56455665
react-is "^16.8.4"
56465666

5647-
pretty-format@^24.5.0, pretty-format@^24.7.0, pretty-format@^24.8.0:
5667+
pretty-format@^24.5.0, pretty-format@^24.8.0:
56485668
version "24.8.0"
56495669
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2"
56505670
integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw==
@@ -5791,14 +5811,6 @@ react-redux@^7.0.3:
57915811
prop-types "^15.7.2"
57925812
react-is "^16.8.6"
57935813

5794-
react-testing-library@^7.0.1:
5795-
version "7.0.1"
5796-
resolved "https://registry.yarnpkg.com/react-testing-library/-/react-testing-library-7.0.1.tgz#0cf113bb53a78599f018378f6854e91a52dbf205"
5797-
integrity sha512-doQkM3/xPcIm22x9jgTkGxU8xqXg4iWvM1WwbbQ7CI5/EMk3DhloYBwMyk+Ywtta3dIAIh9sC7llXoKovf3L+w==
5798-
dependencies:
5799-
"@babel/runtime" "^7.4.3"
5800-
dom-testing-library "^4.1.0"
5801-
58025814
react@^16.8.3:
58035815
version "16.8.6"
58045816
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
@@ -6179,16 +6191,16 @@ rollup-plugin-filesize@^6.1.0:
61796191
gzip-size "^5.0.0"
61806192
terser "^3.10.0"
61816193

6182-
rollup-plugin-node-resolve@^5.0.0:
6183-
version "5.0.0"
6184-
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.0.0.tgz#754abf4841ed4bab2241551cba0a11d04c57f290"
6185-
integrity sha512-JUFr7DkFps3div9DYwpSg0O+s8zuSSRASUZUVNx6h6zhw2m8vcpToeS68JDPsFbmisMVSMYK0IxftngCRv7M9Q==
6194+
rollup-plugin-node-resolve@^5.0.1:
6195+
version "5.0.1"
6196+
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.0.1.tgz#4619eafdf2ecb4e8ed24177ba47d7f11f027d38b"
6197+
integrity sha512-9s3dTu44SKQZM/Pwll42GpqXgT+WdvO0Ga01lF8cwZqJGqRUATtD+GrP3uIzZdpnbPonEJbVasfFt80VGPQqKw==
61866198
dependencies:
61876199
"@types/resolve" "0.0.8"
61886200
builtin-modules "^3.1.0"
61896201
is-module "^1.0.0"
6190-
resolve "^1.10.1"
6191-
rollup-pluginutils "^2.7.0"
6202+
resolve "^1.11.0"
6203+
rollup-pluginutils "^2.8.0"
61926204

61936205
rollup-plugin-replace@^2.2.0:
61946206
version "2.2.0"
@@ -6232,10 +6244,17 @@ rollup-pluginutils@^2.7.0:
62326244
estree-walker "^0.6.0"
62336245
micromatch "^3.1.10"
62346246

6235-
rollup@^1.12.5:
6236-
version "1.12.5"
6237-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.12.5.tgz#11840535a2bc3591e95583c111d55fdf795e55c8"
6238-
integrity sha512-XF5YdpeKX4ueGpBCW07AxPJJHu7SHaobYzu2lZnMPX908Ely2LZF0a0EQPgb+iVy5kP4cb4QT3nXIAnyAxpL3A==
6247+
rollup-pluginutils@^2.8.0:
6248+
version "2.8.0"
6249+
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.0.tgz#d7ece1502958a35748a74080c7ac5e95681bcbe9"
6250+
integrity sha512-8TomM64VQH6w+13lemFHX5sZYxLCxHhf9gzdRUEFNXH3Z+0CDYy7Grzqa6YUbZc0GIrfbWoD5GXZ3o5Teqh9ew==
6251+
dependencies:
6252+
estree-walker "^0.6.1"
6253+
6254+
rollup@^1.13.1:
6255+
version "1.13.1"
6256+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.13.1.tgz#86a474c29df0f303ed31e4c8be5d81c1038beae8"
6257+
integrity sha512-TWBmVU5WS4wOy5Ij2qxrJYRUn/keECvStcXDpJSwgr95JZ6VFf1PDewiAk4VPf5vxr7drRJlxh9kYpxHveYOOg==
62396258
dependencies:
62406259
"@types/estree" "0.0.39"
62416260
"@types/node" "^12.0.3"
@@ -7184,10 +7203,10 @@ w3c-hr-time@^1.0.1:
71847203
dependencies:
71857204
browser-process-hrtime "^0.1.2"
71867205

7187-
wait-for-expect@^1.1.1:
7188-
version "1.1.1"
7189-
resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-1.1.1.tgz#9cd10e07d52810af9e0aaf509872e38f3c3d81ae"
7190-
integrity sha512-vd9JOqqEcBbCDhARWhW85ecjaEcfBLuXgVBqatfS3iw6oU4kzAcs+sCNjF+TC9YHPImCW7ypsuQc+htscIAQCw==
7206+
wait-for-expect@^1.2.0:
7207+
version "1.2.0"
7208+
resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-1.2.0.tgz#fdab6a26e87d2039101db88bff3d8158e5c3e13f"
7209+
integrity sha512-EJhKpA+5UHixduMBEGhTFuLuVgQBKWxkFbefOdj2bbk2/OpA5Opsc4aUTGmF+qJ+v3kTGxDRNYwKaT4j6g5n8Q==
71917210

71927211
walker@^1.0.7, walker@~1.0.5:
71937212
version "1.0.7"

0 commit comments

Comments
 (0)