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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 52487eeaf581..64375e1d65d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,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 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: 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..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": "*", - "react-testing-library": "*" + "jest": "*" }, "scripts": { "test": "jest" 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: diff --git a/yarn.lock b/yarn.lock index 0423551f06b9..18612e815ce4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1217,10 +1217,10 @@ 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": - version "7.5.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.4.tgz#cb7d1ad7c6d65676e66b47186577930465b5271b" - integrity sha512-Na84uwyImZZc3FKf4aUF1tysApzwf3p2yuFBIyBfbzT5glzKTdvYI4KVW4kcgjrzoGUjC7w3YyCHcJKaRxsr2Q== +"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.5", "@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" @@ -2124,6 +2124,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" @@ -3031,7 +3050,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= @@ -5407,16 +5426,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" @@ -11759,14 +11768,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" @@ -14036,7 +14037,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==