From 19faedf3d993ebfcb95d710cc4b204535e59b179 Mon Sep 17 00:00:00 2001 From: Jack Pope Date: Wed, 24 Apr 2024 14:57:59 -0400 Subject: [PATCH 1/2] Update test warning content --- src/content/warnings/react-test-renderer.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/content/warnings/react-test-renderer.md b/src/content/warnings/react-test-renderer.md index 7926922d174..452ca35d5b7 100644 --- a/src/content/warnings/react-test-renderer.md +++ b/src/content/warnings/react-test-renderer.md @@ -4,11 +4,20 @@ title: react-test-renderer Deprecation Warnings ## ReactTestRenderer.create() warning {/*reacttestrenderercreate-warning*/} -react-test-renderer is deprecated. A warning will fire whenever calling ReactTestRenderer.create() or ReactShallowRender.render(). The react-test-renderer package will remain available on NPM but will not be maintained and may break with new React features or changes to React's internals. +`react-test-renderer` is deprecated. An error will log whenever calling ReactTestRenderer.create(). The package will remain available on NPM but will not be maintained and will break with new React features or changes to React's internals. + The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience. +If your application has extensive `react-test-renderer` usage, consider pinning the package to an alias such as `react-test-renderer-DO_NOT_USE` and incrementally migrating to `testing-library`. When your tests have been migrated, you can upgrade to React 19 with more confidence. + ## new ShallowRenderer() warning {/*new-shallowrenderer-warning*/} -The react-test-renderer package no longer exports a shallow renderer at `react-test-renderer/shallow`. This was simply a repackaging of a previously extracted separate package: `react-shallow-renderer`. Therefore you can continue using the shallow renderer in the same way by installing it directly. See [Github](https://github.com/enzymejs/react-shallow-renderer) / [NPM](https://www.npmjs.com/package/react-shallow-renderer). \ No newline at end of file +Shallow rendering is no longer supported. As of React 19, the `react-test-renderer` package no longer exports a renderer at `react-test-renderer/shallow` and you will get an error when creating a `ShallowRenderer` instance. + + +The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience. + +If your application has extensive `react-test-renderer/shallow` usage, consider installing the external package, [`react-shallow-renderer`](https://www.npmjs.com/package/react-shallow-renderer), pinning it to an alias such as `react-shallow-renderer-DO_NOT_USE`, and incrementally migrating to `testing-library`. When your tests have been migrated, you can upgrade to React 19 with more confidence. + \ No newline at end of file From b3125e4b484c25e5b49e5bca44296e1ee8b86610 Mon Sep 17 00:00:00 2001 From: Jack Pope Date: Wed, 24 Apr 2024 17:34:04 -0400 Subject: [PATCH 2/2] clarify legacy renderer behavior --- src/content/warnings/react-test-renderer.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/content/warnings/react-test-renderer.md b/src/content/warnings/react-test-renderer.md index 452ca35d5b7..55959f8fc90 100644 --- a/src/content/warnings/react-test-renderer.md +++ b/src/content/warnings/react-test-renderer.md @@ -9,7 +9,9 @@ title: react-test-renderer Deprecation Warnings The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience. -If your application has extensive `react-test-renderer` usage, consider pinning the package to an alias such as `react-test-renderer-DO_NOT_USE` and incrementally migrating to `testing-library`. When your tests have been migrated, you can upgrade to React 19 with more confidence. +If your application has extensive `react-test-renderer` usage, consider pinning the package to an alias such as `react-test-renderer-18-DO_NOT_USE` and incrementally migrating to `testing-library`. + +Tests using deprecated renderers will effectively be stuck on an old version and will not work with new React features such as Actions. ## new ShallowRenderer() warning {/*new-shallowrenderer-warning*/} @@ -19,5 +21,7 @@ Shallow rendering is no longer supported. As of React 19, the `react-test-render The React Team recommends migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience. -If your application has extensive `react-test-renderer/shallow` usage, consider installing the external package, [`react-shallow-renderer`](https://www.npmjs.com/package/react-shallow-renderer), pinning it to an alias such as `react-shallow-renderer-DO_NOT_USE`, and incrementally migrating to `testing-library`. When your tests have been migrated, you can upgrade to React 19 with more confidence. +If your application has extensive `react-test-renderer/shallow` usage, consider installing the external package, [`react-shallow-renderer`](https://www.npmjs.com/package/react-shallow-renderer), pinning it to an alias such as `react-shallow-renderer-18-DO_NOT_USE`, and incrementally migrating to `testing-library`. + +Tests using deprecated renderers will effectively be stuck on an old version and will not work with new React features such as Actions. \ No newline at end of file