From 890b41813068634ea9e860d2b28495dec39a0e90 Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Fri, 26 Jul 2019 09:45:06 -0300 Subject: [PATCH 1/6] Updated react-testing-library package name to @testing-library/react in docs --- docs/TutorialReact.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md index 97e6e93ea421..a24fa8a33ff7 100644 --- a/docs/TutorialReact.md +++ b/docs/TutorialReact.md @@ -212,7 +212,7 @@ If you'd like to assert, and manipulate your rendered components you can use [re #### react-testing-library -You have to run `yarn add --dev react-testing-library` to use react-testing-library. +You have to run `yarn add --dev @testing-library/react` to use react-testing-library. Let's implement a simple checkbox which swaps between two labels: From d56fb90f2f70ecdbe93adc5a502fbe09b3368b46 Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Fri, 26 Jul 2019 10:07:48 -0300 Subject: [PATCH 2/6] Updated changelog.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 208b90faf636..8c01aa46dea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - `[docs]` Add information about using `jest.doMock` with ES6 imports ([#8573](https://github.com/facebook/jest/pull/8573)) - `[docs]` Fix variable name in custom-matcher-api code example ([#8582](https://github.com/facebook/jest/pull/8582)) - `[docs]` Fix example used in custom environment docs ([#8617](https://github.com/facebook/jest/pull/8617)) +- `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) ### Performance From b148ac1b62c3fc9c32eeecdd5583272ed59ad2e8 Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Fri, 26 Jul 2019 19:09:38 -0300 Subject: [PATCH 3/6] Updated versioned docs --- website/versioned_docs/version-24.0/TutorialReact.md | 2 +- website/versioned_docs/version-24.8/TutorialReact.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/versioned_docs/version-24.0/TutorialReact.md b/website/versioned_docs/version-24.0/TutorialReact.md index a398d5705e94..4268ca9ceb95 100644 --- a/website/versioned_docs/version-24.0/TutorialReact.md +++ b/website/versioned_docs/version-24.0/TutorialReact.md @@ -213,7 +213,7 @@ If you'd like to assert, and manipulate your rendered components you can use [re #### react-testing-library -You have to run `yarn add --dev react-testing-library` to use react-testing-library. +You have to run `yarn add --dev @testing-library/react` to use react-testing-library. Let's implement a simple checkbox which swaps between two labels: diff --git a/website/versioned_docs/version-24.8/TutorialReact.md b/website/versioned_docs/version-24.8/TutorialReact.md index 2c2c38bc044a..acf28a84e09d 100644 --- a/website/versioned_docs/version-24.8/TutorialReact.md +++ b/website/versioned_docs/version-24.8/TutorialReact.md @@ -213,7 +213,7 @@ If you'd like to assert, and manipulate your rendered components you can use [re #### react-testing-library -You have to run `yarn add --dev react-testing-library` to use react-testing-library. +You have to run `yarn add --dev @testing-library/react` to use react-testing-library. Let's implement a simple checkbox which swaps between two labels: From c26baf46d102da5330d337b18b2e9e0dbc65fa21 Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Fri, 26 Jul 2019 19:10:53 -0300 Subject: [PATCH 4/6] Updated react-testing-library example --- .../__tests__/CheckboxWithLabel-test.js | 2 +- examples/react-testing-library/package.json | 2 +- yarn.lock | 50 +++++++++++-------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js b/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js index cd3cf4832b94..190e3fec0d34 100644 --- a/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js +++ b/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js @@ -1,7 +1,7 @@ // Copyright 2004-present Facebook. All Rights Reserved. import React from 'react'; -import {render, fireEvent, cleanup} from 'react-testing-library'; +import {render, fireEvent, cleanup} from '@testing-library/react'; import CheckboxWithLabel from '../CheckboxWithLabel'; // automatically unmount and cleanup DOM after the test is finished. diff --git a/examples/react-testing-library/package.json b/examples/react-testing-library/package.json index 271f352011a9..964cd8e5b449 100644 --- a/examples/react-testing-library/package.json +++ b/examples/react-testing-library/package.json @@ -13,7 +13,7 @@ "@babel/preset-react": "*", "babel-jest": "*", "jest": "*", - "react-testing-library": "*" + "@testing-library/react": "*" }, "scripts": { "test": "jest" diff --git a/yarn.lock b/yarn.lock index 44b7d35d16d8..2c425289ffed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -825,13 +825,20 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.3", "@babel/runtime@^7.4.5": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.5": version "7.5.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.4.tgz#cb7d1ad7c6d65676e66b47186577930465b5271b" integrity sha512-Na84uwyImZZc3FKf4aUF1tysApzwf3p2yuFBIyBfbzT5glzKTdvYI4KVW4kcgjrzoGUjC7w3YyCHcJKaRxsr2Q== dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.5.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" + integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.1.2", "@babel/template@^7.2.2": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907" @@ -1699,6 +1706,25 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow== +"@testing-library/dom@^5.5.4": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-5.6.0.tgz#18a7c162a6a79964e731ad7b810022a28218047c" + integrity sha512-nAsRvQLr/b6TGNjuHMEbWXCNPLrQYnzqa/KKQZL7wBOtfptUxsa4Ah9aqkHW0ZmCSFmUDj4nFUxWPVTeMu0iCw== + dependencies: + "@babel/runtime" "^7.4.5" + "@sheerun/mutationobserver-shim" "^0.3.2" + aria-query "3.0.0" + pretty-format "^24.8.0" + wait-for-expect "^1.2.0" + +"@testing-library/react@*": + version "8.0.7" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-8.0.7.tgz#b5992c9156e926850a0e3a7c882ae1aed83b1c77" + integrity sha512-6XoeWSr3UCdxMswbkW0BmuXYw8a6w+stt+5gg4D4zAcljfhXETQ5o28bjJFwNab4OPg8gBNK8KIVot86L4Q8Vg== + dependencies: + "@babel/runtime" "^7.5.4" + "@testing-library/dom" "^5.5.4" + "@types/ansi-escapes@^3.0.0", "@types/ansi-escapes@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@types/ansi-escapes/-/ansi-escapes-3.0.1.tgz#328e46c6ac3177ca4cf2efdeed326cf77da01ef7" @@ -2606,7 +2632,7 @@ argv@^0.0.2: resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab" integrity sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas= -aria-query@^3.0.0: +aria-query@3.0.0, aria-query@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w= @@ -4950,16 +4976,6 @@ dom-serializer@0, dom-serializer@~0.1.0, dom-serializer@~0.1.1: domelementtype "^1.3.0" entities "^1.1.1" -dom-testing-library@^3.13.1: - version "3.19.4" - resolved "https://registry.yarnpkg.com/dom-testing-library/-/dom-testing-library-3.19.4.tgz#f5b737f59ee9749a4568fa353f1f59be97c888c3" - integrity sha512-GJOx8CLpnkvM3takILOsld/itUUc9+7Qh6caN1Spj6+9jIgNPY36fsvoH7sEgYokC0lBRdttO7G7fIFYCXlmcA== - dependencies: - "@babel/runtime" "^7.4.3" - "@sheerun/mutationobserver-shim" "^0.3.2" - pretty-format "^24.7.0" - wait-for-expect "^1.1.1" - dom-walk@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" @@ -11240,14 +11256,6 @@ react-test-renderer@*, react-test-renderer@^16.0.0-0: react-is "^16.8.6" scheduler "^0.13.6" -react-testing-library@*: - version "6.0.0" - resolved "https://registry.yarnpkg.com/react-testing-library/-/react-testing-library-6.0.0.tgz#81edfcfae8a795525f48685be9bf561df45bb35d" - integrity sha512-h0h+YLe4KWptK6HxOMnoNN4ngu3W8isrwDmHjPC5gxc+nOZOCurOvbKVYCvvuAw91jdO7VZSm/5KR7TxKnz0qA== - dependencies: - "@babel/runtime" "^7.3.1" - dom-testing-library "^3.13.1" - react-transform-hmr@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/react-transform-hmr/-/react-transform-hmr-1.0.4.tgz#e1a40bd0aaefc72e8dfd7a7cda09af85066397bb" @@ -13527,7 +13535,7 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" -wait-for-expect@^1.1.1: +wait-for-expect@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-1.2.0.tgz#fdab6a26e87d2039101db88bff3d8158e5c3e13f" integrity sha512-EJhKpA+5UHixduMBEGhTFuLuVgQBKWxkFbefOdj2bbk2/OpA5Opsc4aUTGmF+qJ+v3kTGxDRNYwKaT4j6g5n8Q== From 7c059a2a1b8e6f2655070197820d680ea55c3b2a Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Fri, 26 Jul 2019 19:11:44 -0300 Subject: [PATCH 5/6] Updated circleci config to remove react-testing-library example in node 6 --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf29628f4b33..4b00c42135d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,8 +41,8 @@ jobs: - run: *install - save-cache: *save-cache - run: - # react-native does not work with node 6 - command: rm -rf examples/react-native && yarn test-ci-partial + # react-native and react-testing-library do not work with node 6 + command: rm -rf examples/react-native examples/react-testing-library && yarn test-ci-partial - store_test_results: path: reports/junit From 67616341d76a1970edc69290b816481455ead0c5 Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Fri, 26 Jul 2019 19:56:52 -0300 Subject: [PATCH 6/6] Change from PR discussion --- examples/react-testing-library/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/react-testing-library/package.json b/examples/react-testing-library/package.json index 964cd8e5b449..6f5ca6db0820 100644 --- a/examples/react-testing-library/package.json +++ b/examples/react-testing-library/package.json @@ -11,9 +11,9 @@ "@babel/plugin-proposal-class-properties": "*", "@babel/preset-env": "*", "@babel/preset-react": "*", + "@testing-library/react": "*", "babel-jest": "*", - "jest": "*", - "@testing-library/react": "*" + "jest": "*" }, "scripts": { "test": "jest"