From 05b0a6f6342702a85689c5faa6385fda7423fc39 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Wed, 20 Oct 2021 09:52:57 +0200 Subject: [PATCH 1/3] ref(sentry-test/enzyme): Add warning message --- tests/js/sentry-test/enzyme.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/js/sentry-test/enzyme.js b/tests/js/sentry-test/enzyme.js index 04ed17abe0f1cb..794ec7e6cbed1a 100644 --- a/tests/js/sentry-test/enzyme.js +++ b/tests/js/sentry-test/enzyme.js @@ -4,6 +4,10 @@ import {mount, render, shallow} from 'enzyme'; // eslint-disable-line no-restric import {lightTheme} from 'app/utils/theme'; +/** + * As we are migrating our tests to React Testing Library, + * please avoid using `sentry-test/enzyme` and use `sentry-test/reactTestingLibrary` instead. + */ const mountWithTheme = (tree, opts) => { const WrappingThemeProvider = props => ( From ab6a42da5408979aef493caa4e0928521fa73b22 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Wed, 20 Oct 2021 09:54:51 +0200 Subject: [PATCH 2/3] add deprecated --- tests/js/sentry-test/enzyme.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/js/sentry-test/enzyme.js b/tests/js/sentry-test/enzyme.js index 794ec7e6cbed1a..1441c5b9a7b95d 100644 --- a/tests/js/sentry-test/enzyme.js +++ b/tests/js/sentry-test/enzyme.js @@ -5,6 +5,7 @@ import {mount, render, shallow} from 'enzyme'; // eslint-disable-line no-restric import {lightTheme} from 'app/utils/theme'; /** + * @deprecated * As we are migrating our tests to React Testing Library, * please avoid using `sentry-test/enzyme` and use `sentry-test/reactTestingLibrary` instead. */ From ad10cd0f8e53dbd59038f5f9ef33bc9cdd11473b Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Wed, 20 Oct 2021 10:13:41 +0200 Subject: [PATCH 3/3] remove enzyme render --- tests/js/sentry-test/enzyme.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/js/sentry-test/enzyme.js b/tests/js/sentry-test/enzyme.js index 1441c5b9a7b95d..673bd34c64d16d 100644 --- a/tests/js/sentry-test/enzyme.js +++ b/tests/js/sentry-test/enzyme.js @@ -1,13 +1,13 @@ import {cache} from '@emotion/css'; // eslint-disable-line emotion/no-vanilla import {CacheProvider, ThemeProvider} from '@emotion/react'; -import {mount, render, shallow} from 'enzyme'; // eslint-disable-line no-restricted-imports +import {mount, shallow as enzymeShallow} from 'enzyme'; // eslint-disable-line no-restricted-imports import {lightTheme} from 'app/utils/theme'; /** * @deprecated * As we are migrating our tests to React Testing Library, - * please avoid using `sentry-test/enzyme` and use `sentry-test/reactTestingLibrary` instead. + * please avoid using `sentry-test/enzyme/mountWithTheme` and use `sentry-test/reactTestingLibrary/mountWithTheme` instead. */ const mountWithTheme = (tree, opts) => { const WrappingThemeProvider = props => ( @@ -19,4 +19,11 @@ const mountWithTheme = (tree, opts) => { return mount(tree, {wrappingComponent: WrappingThemeProvider, ...opts}); }; -export {mountWithTheme, render, shallow}; +/** + * @deprecated + * As we are migrating our tests to React Testing Library, + * please avoid using `sentry-test/enzyme/shallow` and use `sentry-test/reactTestingLibrary/mountWithTheme` instead. + */ +const shallow = enzymeShallow; + +export {mountWithTheme, shallow};