From 7fb34d4037b97f74bd10be2e606fba6310aa423b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Garc=C3=ADa=20Herv=C3=A1s?= Date: Wed, 26 Jun 2024 20:45:24 +0200 Subject: [PATCH] [test] Remove enzyme (#42706) --- package.json | 3 - packages-internal/test-utils/package.json | 3 - packages-internal/test-utils/src/init.js | 4 - packages-internal/test-utils/src/until.js | 28 -- .../test-utils/src/until.test.js | 120 -------- pnpm-lock.yaml | 277 ------------------ scripts/useReactVersion.mjs | 5 +- test/README.md | 1 - test/karma.conf.js | 6 +- test/karma.conf.profile.js | 4 +- test/regressions/webpack.config.js | 6 +- 11 files changed, 7 insertions(+), 450 deletions(-) delete mode 100644 packages-internal/test-utils/src/until.js delete mode 100644 packages-internal/test-utils/src/until.test.js diff --git a/package.json b/package.json index 5b02c2c11513a6..faa5c4bd80018b 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,6 @@ "@babel/preset-react": "^7.24.7", "@babel/preset-typescript": "^7.24.7", "@babel/register": "^7.24.6", - "@mnajdova/enzyme-adapter-react-18": "^0.2.0", "@mui-internal/api-docs-builder": "workspace:^", "@mui-internal/api-docs-builder-core": "workspace:^", "@mui/internal-docs-utils": "workspace:^", @@ -120,7 +119,6 @@ "@octokit/rest": "^20.1.1", "@pigment-css/react": "^0.0.13", "@playwright/test": "1.44.1", - "@types/enzyme": "^3.10.18", "@types/fs-extra": "^11.0.4", "@types/lodash": "^4.17.5", "@types/mocha": "^10.0.7", @@ -142,7 +140,6 @@ "cpy-cli": "^5.0.0", "cross-env": "^7.0.3", "danger": "^12.3.3", - "enzyme": "^3.11.0", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^18.0.0", diff --git a/packages-internal/test-utils/package.json b/packages-internal/test-utils/package.json index 0e2e8e27bd4b4a..2523916d8b6b30 100644 --- a/packages-internal/test-utils/package.json +++ b/packages-internal/test-utils/package.json @@ -37,13 +37,11 @@ "@babel/runtime": "^7.24.7", "@emotion/cache": "^11.11.0", "@emotion/react": "^11.11.4", - "@mnajdova/enzyme-adapter-react-18": "^0.2.0", "@testing-library/dom": "^10.1.0", "@testing-library/react": "^16.0.0", "chai": "^4.4.1", "chai-dom": "^1.12.0", "dom-accessibility-api": "^0.6.3", - "enzyme": "^3.11.0", "format-util": "^1.0.5", "fs-extra": "^11.2.0", "jsdom": "^24.0.0", @@ -57,7 +55,6 @@ "devDependencies": { "@types/chai": "^4.3.16", "@types/chai-dom": "^1.11.3", - "@types/enzyme": "^3.10.18", "@types/format-util": "^1.0.4", "@types/prop-types": "^15.7.12", "@types/react": "^18.2.55", diff --git a/packages-internal/test-utils/src/init.js b/packages-internal/test-utils/src/init.js index d55b0f7f719b4f..85e2fe80a5eb6c 100644 --- a/packages-internal/test-utils/src/init.js +++ b/packages-internal/test-utils/src/init.js @@ -1,10 +1,6 @@ -import enzyme from 'enzyme'; -import Adapter from '@mnajdova/enzyme-adapter-react-18'; import * as testingLibrary from '@testing-library/react/pure'; import './initMatchers'; -enzyme.configure({ adapter: new Adapter() }); - // checking if an element is hidden is quite expensive // this is only done in CI as a fail safe. It can still explicitly be checked // in the test files which helps documenting what is part of the DOM but hidden diff --git a/packages-internal/test-utils/src/until.js b/packages-internal/test-utils/src/until.js deleted file mode 100644 index aab33f8085bf51..00000000000000 --- a/packages-internal/test-utils/src/until.js +++ /dev/null @@ -1,28 +0,0 @@ -function shallowRecursively(wrapper, selector, { context, ...other }) { - if (wrapper.isEmptyRender() || typeof wrapper.getElement().type === 'string') { - return wrapper; - } - - let newContext = context; - - const instance = wrapper.root().instance(); - // The instance can be null with a stateless functional component and react >= 16. - if (instance && instance.getChildContext) { - newContext = { - ...context, - ...instance.getChildContext(), - }; - } - - const nextWrapper = wrapper.shallow({ context: newContext, ...other }); - - if (selector && wrapper.is(selector)) { - return nextWrapper; - } - - return shallowRecursively(nextWrapper, selector, { context: newContext }); -} - -export default function until(selector, options = {}) { - return this.single('until', () => shallowRecursively(this, selector, options)); -} diff --git a/packages-internal/test-utils/src/until.test.js b/packages-internal/test-utils/src/until.test.js deleted file mode 100644 index ee9edc05292249..00000000000000 --- a/packages-internal/test-utils/src/until.test.js +++ /dev/null @@ -1,120 +0,0 @@ -import * as React from 'react'; -import { expect } from 'chai'; -import PropTypes from 'prop-types'; -import { shallow } from 'enzyme'; -import until from './until'; - -function Div() { - return
; -} -const hoc = (Component) => - function Wrapper() { - return ; - }; - -describe('until', () => { - it('shallow renders the current wrapper one level deep', () => { - const EnhancedDiv = hoc(Div); - const wrapper = until.call(shallow(), 'Div'); - expect(wrapper.contains(
)).to.equal(true); - }); - - it('shallow renders the current wrapper several levels deep', () => { - const EnhancedDiv = hoc(hoc(hoc(Div))); - const wrapper = until.call(shallow(), 'Div'); - expect(wrapper.contains(
)).to.equal(true); - }); - - it('stops shallow rendering when the wrapper is empty', () => { - const nullHoc = () => () => null; - const EnhancedDiv = nullHoc(); - const wrapper = until.call(shallow(), 'Div'); - expect(wrapper.html()).to.equal(null); - }); - - it('shallow renders as much as possible when no selector is provided', () => { - const EnhancedDiv = hoc(hoc(Div)); - const wrapper = until.call(shallow()); - expect(wrapper.contains(
)).to.equal(true); - }); - - it('shallow renders the current wrapper even if the selector never matches', () => { - const EnhancedDiv = hoc(Div); - const wrapper = until.call(shallow(), 'NotDiv'); - expect(wrapper.contains(
)).to.equal(true); - }); - - it('stops shallow rendering when it encounters a HTML element', () => { - const wrapper = until.call( - shallow( -
-
-
, - ), - 'Div', - ); - expect( - wrapper.contains( -
-
-
, - ), - ).to.equal(true); - }); - - it('throws when until called on an empty wrapper', () => { - expect(() => { - until.call(shallow(
).find('Foo'), 'div'); - }).to.throw(Error); - }); - - it('shallow renders non-root wrappers', () => { - function Container() { - return ( -
-
-
- ); - } - const wrapper = until.call(shallow().find(Div)); - expect(wrapper.contains(
)).to.equal(true); - }); - - // eslint-disable-next-line react/prefer-stateless-function - class Foo extends React.Component { - render() { - return
; - } - } - - Foo.contextTypes = { - quux: PropTypes.bool.isRequired, - }; - - it('context propagation passes down context from the root component', () => { - const EnhancedFoo = hoc(Foo); - const options = { context: { quux: true } }; - const wrapper = until.call(shallow(, options), 'Foo', options); - expect(wrapper.context('quux')).to.equal(true); - expect(wrapper.contains(
)).to.equal(true); - }); - - class Bar extends React.Component { - static childContextTypes = { quux: PropTypes.bool }; - - getChildContext() { - return { quux: true }; - } - - render() { - return ; - } - } - - it('context propagation passes down context from an intermediary component', () => { - const EnhancedBar = hoc(Bar); - const wrapper = until.call(shallow(), 'Foo'); - expect(wrapper.context('quux')).to.equal(true); - expect(wrapper.contains(
)).to.equal(true); - }); -}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac55e4b6b11299..a2402e44e35a09 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -71,9 +71,6 @@ importers: '@babel/register': specifier: ^7.24.6 version: 7.24.6(@babel/core@7.24.7) - '@mnajdova/enzyme-adapter-react-18': - specifier: ^0.2.0 - version: 0.2.0(enzyme@3.11.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@mui-internal/api-docs-builder': specifier: workspace:^ version: link:packages/api-docs-builder @@ -110,9 +107,6 @@ importers: '@playwright/test': specifier: 1.44.1 version: 1.44.1 - '@types/enzyme': - specifier: ^3.10.18 - version: 3.10.18 '@types/fs-extra': specifier: ^11.0.4 version: 11.0.4 @@ -176,9 +170,6 @@ importers: danger: specifier: ^12.3.3 version: 12.3.3(encoding@0.1.13) - enzyme: - specifier: ^3.11.0 - version: 3.11.0 eslint: specifier: ^8.57.0 version: 8.57.0 @@ -1002,9 +993,6 @@ importers: '@emotion/react': specifier: ^11.11.4 version: 11.11.4(@types/react@18.2.55)(react@18.2.0) - '@mnajdova/enzyme-adapter-react-18': - specifier: ^0.2.0 - version: 0.2.0(enzyme@3.11.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@testing-library/dom': specifier: ^10.1.0 version: 10.1.0 @@ -1020,9 +1008,6 @@ importers: dom-accessibility-api: specifier: ^0.6.3 version: 0.6.3 - enzyme: - specifier: ^3.11.0 - version: 3.11.0 format-util: specifier: ^1.0.5 version: 1.0.5 @@ -1063,9 +1048,6 @@ importers: '@types/chai-dom': specifier: ^1.11.3 version: 1.11.3 - '@types/enzyme': - specifier: ^3.10.18 - version: 3.10.18 '@types/format-util': specifier: ^1.0.4 version: 1.0.4 @@ -3817,13 +3799,6 @@ packages: resolution: {integrity: sha512-JFvIYrlvR8Txa8h7VZx8VIQDltukEKOKaZL/muGO7Q/5aE2vjOKHsD/jkWYe/2uFy1xv37ubdx17O1UXQNadPg==} engines: {node: '>=18.0.0'} - '@mnajdova/enzyme-adapter-react-18@0.2.0': - resolution: {integrity: sha512-BOnjlVa7FHI1YUnYe+FdUtQu6szI1wLJ+C1lHyqmF3T9gu/J/WCYqqcD44dPkrU+8eYvvk/gQducsqna4HFiAg==} - peerDependencies: - enzyme: ^3.0.0 - react: ^18.0.0 - react-dom: ^18.0.0 - '@mui/base@5.0.0-beta.30': resolution: {integrity: sha512-dc38W4W3K42atE9nSaOeoJ7/x9wGIfawdwC/UmMxMLlZ1iSsITQ8dQJaTATCbn98YvYPINK/EH541YA5enQIPQ==} engines: {node: '>=12.0.0'} @@ -5219,9 +5194,6 @@ packages: '@types/chai@4.3.16': resolution: {integrity: sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ==} - '@types/cheerio@0.22.31': - resolution: {integrity: sha512-Kt7Cdjjdi2XWSfrZ53v4Of0wG3ZcmaegFXjMmz9tfNrZSkzzo36G0AL1YqSdcIA78Etjt6E609pt5h1xnQkPUw==} - '@types/connect@3.4.35': resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} @@ -5240,9 +5212,6 @@ packages: '@types/doctrine@0.0.9': resolution: {integrity: sha512-eOIHzCUSH7SMfonMG1LsC2f8vxBFtho6NGBznK41R84YzPuvSBzrhEps33IsQiOW9+VL6NQ9DbjQJznk/S4uRA==} - '@types/enzyme@3.10.18': - resolution: {integrity: sha512-RaO/TyyHZvXkpzinbMTZmd/S5biU4zxkvDsn22ujC29t9FMSzq8tnn8f2MxQ2P8GVhFRG5jTAL05DXKyTtpEQQ==} - '@types/eslint-scope@3.7.4': resolution: {integrity: sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==} @@ -5678,12 +5647,6 @@ packages: resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==} engines: {node: '>=12'} - airbnb-prop-types@2.16.0: - resolution: {integrity: sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg==} - deprecated: This package has been renamed to 'prop-types-tools' - peerDependencies: - react: ^0.14 || ^15.0.0 || ^16.0.0-alpha - ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: @@ -5848,10 +5811,6 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} - array.prototype.filter@1.0.1: - resolution: {integrity: sha512-Dk3Ty7N42Odk7PjU/Ci3zT4pLj20YvuVnneG/58ICM6bt4Ij5kZaJTVQ9TSaWaIECX2sFyz4KItkVZqHNnciqw==} - engines: {node: '>= 0.4'} - array.prototype.find@2.2.2: resolution: {integrity: sha512-DRumkfW97iZGOfn+lIXbkVrXL04sfYKX+EfOodo8XboR5sxPDVvOjZTF/rysusa9lmhmSOeD6Vp6RKQP+eP4Tg==} @@ -6337,13 +6296,6 @@ packages: check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} - cheerio-select@2.1.0: - resolution: {integrity: sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==} - - cheerio@1.0.0-rc.12: - resolution: {integrity: sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==} - engines: {node: '>= 6'} - chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} @@ -7062,9 +7014,6 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} - discontinuous-range@1.0.0: - resolution: {integrity: sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==} - dlv@1.1.3: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} @@ -7218,17 +7167,6 @@ packages: engines: {node: '>=4'} hasBin: true - enzyme-adapter-utils@1.14.0: - resolution: {integrity: sha512-F/z/7SeLt+reKFcb7597IThpDp0bmzcH1E9Oabqv+o01cID2/YInlqHbFl7HzWBl4h3OdZYedtwNDOmSKkk0bg==} - peerDependencies: - react: 0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0 - - enzyme-shallow-equal@1.0.4: - resolution: {integrity: sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q==} - - enzyme@3.11.0: - resolution: {integrity: sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==} - err-code@2.0.3: resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} @@ -8135,9 +8073,6 @@ packages: resolution: {integrity: sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==} engines: {node: ^16.14.0 || >=18.0.0} - html-element-map@1.3.1: - resolution: {integrity: sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==} - html-encoding-sniffer@4.0.0: resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} engines: {node: '>=18'} @@ -8173,9 +8108,6 @@ packages: htmlparser2@6.1.0: resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==} - htmlparser2@8.0.1: - resolution: {integrity: sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==} - http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} @@ -8553,9 +8485,6 @@ packages: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} - is-subset@0.1.1: - resolution: {integrity: sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw==} - is-symbol@1.0.4: resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} engines: {node: '>= 0.4'} @@ -9102,9 +9031,6 @@ packages: lodash.difference@4.5.0: resolution: {integrity: sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==} - lodash.escape@4.0.1: - resolution: {integrity: sha512-nXEOnb/jK9g0DYMr1/Xvq6l5xMD7GDG55+GSYIYmS0G4tBk/hURD4JR9WCavs04t33WmJx9kCyp9vJ+mr4BOUw==} - lodash.escaperegexp@4.1.2: resolution: {integrity: sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==} @@ -9588,9 +9514,6 @@ packages: module-details-from-path@1.0.3: resolution: {integrity: sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==} - moo@0.5.1: - resolution: {integrity: sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==} - mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -9637,10 +9560,6 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - nearley@2.20.1: - resolution: {integrity: sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==} - hasBin: true - negotiator@0.6.3: resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} engines: {node: '>= 0.6'} @@ -10186,9 +10105,6 @@ packages: parse-url@8.1.0: resolution: {integrity: sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w==} - parse5-htmlparser2-tree-adapter@7.0.0: - resolution: {integrity: sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==} - parse5@7.1.2: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} @@ -10269,9 +10185,6 @@ packages: peek-stream@1.1.3: resolution: {integrity: sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==} - performance-now@2.1.0: - resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} - picocolors@0.2.1: resolution: {integrity: sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==} @@ -10554,9 +10467,6 @@ packages: resolution: {integrity: sha512-KQVDEubSUHGSt5xLakaToDFrSoZhStB8dXLzk2xvwR67gJktrHFvpR63oZgHyK19WKbHFLXJqCPXdVR3aBP8Ig==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - prop-types-exact@1.2.0: - resolution: {integrity: sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA==} - prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} @@ -10613,7 +10523,6 @@ packages: engines: {node: '>=0.6.0', teleport: '>=0.2.0'} deprecated: |- You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. - (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) qjobs@1.2.0: @@ -10650,19 +10559,9 @@ packages: resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==} engines: {node: '>=10'} - raf@3.4.1: - resolution: {integrity: sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==} - - railroad-diagrams@1.0.0: - resolution: {integrity: sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==} - rambda@7.5.0: resolution: {integrity: sha512-y/M9weqWAH4iopRd7EHDEQQvpFPHj1AA3oHozE9tfITHUtTR7Z9PSlIRRG2l1GuW7sefC1cXFfIcF+cgnShdBA==} - randexp@0.4.6: - resolution: {integrity: sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==} - engines: {node: '>=0.12'} - randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -11005,9 +10904,6 @@ packages: resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} engines: {node: '>= 0.4'} - reflect.ownkeys@0.2.0: - resolution: {integrity: sha512-qOLsBKHCpSOFKK1NUOCGC5VyeufB6lEsFe92AL2bhIJsacZS1qdoOZSbPk3MYKuT2cFlRDnulKXuuElIrMjGUg==} - regenerate-unicode-properties@10.1.0: resolution: {integrity: sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==} engines: {node: '>=4'} @@ -11132,10 +11028,6 @@ packages: resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} engines: {node: '>=8'} - ret@0.1.15: - resolution: {integrity: sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==} - engines: {node: '>=0.12'} - retry@0.12.0: resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} engines: {node: '>= 4'} @@ -11192,9 +11084,6 @@ packages: rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} - rst-selector-parser@2.2.3: - resolution: {integrity: sha512-nDG1rZeP6oFTLN6yNDV/uiAvs1+FS/KlrEwh7+y7dpuApDBy6bI2HTBcc0/V8lv9OTqfyD34eF7au2pm8aBbhA==} - rtl-css-js@1.16.0: resolution: {integrity: sha512-Oc7PnzwIEU4M0K1J4h/7qUUaljXhQ0kCObRsZjxs2HjkpKsnoTMvSmvJ4sqgJZd0zBoEfAyTdnK/jMIYvrjySQ==} @@ -14473,22 +14362,6 @@ snapshots: - encoding - supports-color - '@mnajdova/enzyme-adapter-react-18@0.2.0(enzyme@3.11.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': - dependencies: - enzyme: 3.11.0 - enzyme-adapter-utils: 1.14.0(react@18.2.0) - enzyme-shallow-equal: 1.0.4 - has: 1.0.3 - object.assign: 4.1.5 - object.values: 1.2.0 - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-is: 18.2.0 - react-reconciler: 0.29.0(react@18.2.0) - react-test-renderer: 18.2.0(react@18.2.0) - semver: 5.7.2 - '@mui/base@5.0.0-beta.30(@types/react@18.2.55)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: '@babel/runtime': 7.24.7 @@ -16274,10 +16147,6 @@ snapshots: '@types/chai@4.3.16': {} - '@types/cheerio@0.22.31': - dependencies: - '@types/node': 18.19.39 - '@types/connect@3.4.35': dependencies: '@types/node': 18.19.39 @@ -16294,11 +16163,6 @@ snapshots: '@types/doctrine@0.0.9': {} - '@types/enzyme@3.10.18': - dependencies: - '@types/cheerio': 0.22.31 - '@types/react': 18.2.55 - '@types/eslint-scope@3.7.4': dependencies: '@types/eslint': 8.56.10 @@ -16821,19 +16685,6 @@ snapshots: clean-stack: 4.2.0 indent-string: 5.0.0 - airbnb-prop-types@2.16.0(react@18.2.0): - dependencies: - array.prototype.find: 2.2.2 - function.prototype.name: 1.1.6 - is-regex: 1.1.4 - object-is: 1.1.5 - object.assign: 4.1.5 - object.entries: 1.1.8 - prop-types: 15.8.1 - prop-types-exact: 1.2.0 - react: 18.2.0 - react-is: 16.13.1 - ajv-formats@2.1.1(ajv@8.12.0): optionalDependencies: ajv: 8.12.0 @@ -17015,14 +16866,6 @@ snapshots: array-union@2.1.0: {} - array.prototype.filter@1.0.1: - dependencies: - call-bind: 1.0.7 - define-properties: 1.2.1 - es-abstract: 1.23.3 - es-array-method-boxes-properly: 1.0.0 - is-string: 1.0.7 - array.prototype.find@2.2.2: dependencies: call-bind: 1.0.7 @@ -17711,25 +17554,6 @@ snapshots: dependencies: get-func-name: 2.0.2 - cheerio-select@2.1.0: - dependencies: - boolbase: 1.0.0 - css-select: 5.1.0 - css-what: 6.1.0 - domelementtype: 2.3.0 - domhandler: 5.0.3 - domutils: 3.0.1 - - cheerio@1.0.0-rc.12: - dependencies: - cheerio-select: 2.1.0 - dom-serializer: 2.0.0 - domhandler: 5.0.3 - domutils: 3.0.1 - htmlparser2: 8.0.1 - parse5: 7.1.2 - parse5-htmlparser2-tree-adapter: 7.0.0 - chokidar@3.5.3: dependencies: anymatch: 3.1.3 @@ -18524,8 +18348,6 @@ snapshots: dependencies: path-type: 4.0.0 - discontinuous-range@1.0.0: {} - dlv@1.1.3: {} doctrine@2.1.0: @@ -18693,47 +18515,6 @@ snapshots: envinfo@7.8.1: {} - enzyme-adapter-utils@1.14.0(react@18.2.0): - dependencies: - airbnb-prop-types: 2.16.0(react@18.2.0) - function.prototype.name: 1.1.6 - has: 1.0.3 - object.assign: 4.1.5 - object.fromentries: 2.0.8 - prop-types: 15.8.1 - react: 18.2.0 - semver: 5.7.2 - - enzyme-shallow-equal@1.0.4: - dependencies: - has: 1.0.3 - object-is: 1.1.5 - - enzyme@3.11.0: - dependencies: - array.prototype.flat: 1.3.2 - cheerio: 1.0.0-rc.12 - enzyme-shallow-equal: 1.0.4 - function.prototype.name: 1.1.6 - has: 1.0.3 - html-element-map: 1.3.1 - is-boolean-object: 1.1.2 - is-callable: 1.2.7 - is-number-object: 1.0.7 - is-regex: 1.1.4 - is-string: 1.0.7 - is-subset: 0.1.1 - lodash.escape: 4.0.1 - lodash.isequal: 4.5.0 - object-inspect: 1.13.1 - object-is: 1.1.5 - object.assign: 4.1.5 - object.entries: 1.1.8 - object.values: 1.2.0 - raf: 3.4.1 - rst-selector-parser: 2.2.3 - string.prototype.trim: 1.2.9 - err-code@2.0.3: {} error-ex@1.3.2: @@ -19965,11 +19746,6 @@ snapshots: dependencies: lru-cache: 10.1.0 - html-element-map@1.3.1: - dependencies: - array.prototype.filter: 1.0.1 - call-bind: 1.0.7 - html-encoding-sniffer@4.0.0: dependencies: whatwg-encoding: 3.1.1 @@ -20013,13 +19789,6 @@ snapshots: domutils: 2.8.0 entities: 2.2.0 - htmlparser2@8.0.1: - dependencies: - domelementtype: 2.3.0 - domhandler: 5.0.3 - domutils: 3.0.1 - entities: 4.5.0 - http-cache-semantics@4.1.1: {} http-errors@2.0.0: @@ -20368,8 +20137,6 @@ snapshots: dependencies: has-tostringtag: 1.0.2 - is-subset@0.1.1: {} - is-symbol@1.0.4: dependencies: has-symbols: 1.0.3 @@ -21194,8 +20961,6 @@ snapshots: lodash.difference@4.5.0: {} - lodash.escape@4.0.1: {} - lodash.escaperegexp@4.1.2: {} lodash.find@4.6.0: {} @@ -21824,8 +21589,6 @@ snapshots: module-details-from-path@1.0.3: {} - moo@0.5.1: {} - mri@1.2.0: {} mrmime@1.0.1: {} @@ -21865,13 +21628,6 @@ snapshots: natural-compare@1.4.0: {} - nearley@2.20.1: - dependencies: - commander: 2.20.3 - moo: 0.5.1 - railroad-diagrams: 1.0.0 - randexp: 0.4.6 - negotiator@0.6.3: {} neo-async@2.6.2: {} @@ -22572,11 +22328,6 @@ snapshots: dependencies: parse-path: 7.0.0 - parse5-htmlparser2-tree-adapter@7.0.0: - dependencies: - domhandler: 5.0.3 - parse5: 7.1.2 - parse5@7.1.2: dependencies: entities: 4.5.0 @@ -22641,8 +22392,6 @@ snapshots: duplexify: 3.7.1 through2: 2.0.5 - performance-now@2.1.0: {} - picocolors@0.2.1: {} picocolors@1.0.1: {} @@ -22910,12 +22659,6 @@ snapshots: dependencies: read: 2.1.0 - prop-types-exact@1.2.0: - dependencies: - has: 1.0.3 - object.assign: 4.1.5 - reflect.ownkeys: 0.2.0 - prop-types@15.8.1: dependencies: loose-envify: 1.4.0 @@ -23004,19 +22747,8 @@ snapshots: quick-lru@5.1.1: {} - raf@3.4.1: - dependencies: - performance-now: 2.1.0 - - railroad-diagrams@1.0.0: {} - rambda@7.5.0: {} - randexp@0.4.6: - dependencies: - discontinuous-range: 1.0.0 - ret: 0.1.15 - randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 @@ -23496,8 +23228,6 @@ snapshots: globalthis: 1.0.3 which-builtin-type: 1.1.3 - reflect.ownkeys@0.2.0: {} - regenerate-unicode-properties@10.1.0: dependencies: regenerate: 1.4.2 @@ -23632,8 +23362,6 @@ snapshots: onetime: 5.1.2 signal-exit: 3.0.7 - ret@0.1.15: {} - retry@0.12.0: {} retry@0.13.1: {} @@ -23689,11 +23417,6 @@ snapshots: rrweb-cssom@0.6.0: {} - rst-selector-parser@2.2.3: - dependencies: - lodash.flattendeep: 4.4.0 - nearley: 2.20.1 - rtl-css-js@1.16.0: dependencies: '@babel/runtime': 7.24.7 diff --git a/scripts/useReactVersion.mjs b/scripts/useReactVersion.mjs index 55a4338e626f3b..35cbafdfb25608 100644 --- a/scripts/useReactVersion.mjs +++ b/scripts/useReactVersion.mjs @@ -18,12 +18,11 @@ const exec = promisify(childProcess.exec); // packages published from the react monorepo using the same version const reactPackageNames = ['react', 'react-dom', 'react-is', 'react-test-renderer', 'scheduler']; -const devDependenciesPackageNames = ['@mnajdova/enzyme-adapter-react-18', '@testing-library/react']; +const devDependenciesPackageNames = ['@testing-library/react']; // if we need to support more versions we will need to add new mapping here const additionalVersionsMappings = { 17: { - '@mnajdova/enzyme-adapter-react-18': 'npm:@eps1lon/enzyme-adapter-react-17', '@testing-library/react': '^12.1.0', }, }; @@ -82,8 +81,6 @@ async function main(version) { // At this moment all dist tags reference React 18 version, so we don't need // to update these dependencies unless an older version is used, or when the // next/experimental dist tag reference to a future version of React - // packageJson.devDependencies['@mnajdova/enzyme-adapter-react-18'] = - // 'npm:@mnajdova/enzyme-adapter-react-next'; // packageJson.devDependencies['@testing-library/react'] = 'alpha'; if (majorVersion && additionalVersionsMappings[majorVersion]) { diff --git a/test/README.md b/test/README.md index a2b90eb92f500b..fe750b8bda099f 100644 --- a/test/README.md +++ b/test/README.md @@ -18,7 +18,6 @@ Thanks for writing tests! Here's a quick run-down on our current setup. - [Karma](https://karma-runner.github.io/latest/index.html) - [Playwright](https://playwright.dev/) - [jsdom](https://github.com/jsdom/jsdom) -- [enzyme](https://airbnb.io/enzyme/) (old tests only) ## Writing tests diff --git a/test/karma.conf.js b/test/karma.conf.js index 4002f93ca893b1..998491a3ba9ac0 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -119,7 +119,7 @@ module.exports = function setKarmaConfig(config) { 'process.env.TEST_GATE': JSON.stringify(process.env.TEST_GATE), }), new webpack.ProvidePlugin({ - // required by enzyme > cheerio > parse5 > util + // required by code accessing `process.env` in the browser process: 'process/browser.js', }), ], @@ -189,10 +189,8 @@ module.exports = function setKarmaConfig(config) { // needed by sourcemap fs: false, path: false, - // needed by enzyme > cheerio + // Exclude polyfill and treat 'stream' as an empty module since it is not required. next -> gzip-size relies on it. stream: false, - // required by enzyme > cheerio > parse5 - util: require.resolve('util/'), vm: false, }, }, diff --git a/test/karma.conf.profile.js b/test/karma.conf.profile.js index 4482e12b7983dc..ec06840bee9602 100644 --- a/test/karma.conf.profile.js +++ b/test/karma.conf.profile.js @@ -81,7 +81,7 @@ module.exports = function setKarmaConfig(config) { 'process.env.TEST_GATE': JSON.stringify('enable-dispatching-profiler'), }), new webpack.ProvidePlugin({ - // required by enzyme > cheerio > parse5 > util + // required by code accessing `process.env` in the browser process: 'process/browser.js', }), ], @@ -108,7 +108,7 @@ module.exports = function setKarmaConfig(config) { // needed by sourcemap fs: false, path: false, - // needed by enzyme > cheerio + // Exclude polyfill and treat 'stream' as an empty module since it is not required. next -> gzip-size relies on it. stream: false, }, }, diff --git a/test/regressions/webpack.config.js b/test/regressions/webpack.config.js index b4472eedd1cfe4..bd7c7e9fdc047c 100644 --- a/test/regressions/webpack.config.js +++ b/test/regressions/webpack.config.js @@ -25,7 +25,7 @@ module.exports = { // Avoid bundling the whole @mui/icons-material package. x2 the bundling speed. new webpack.IgnorePlugin({ resourceRegExp: /material-icons\/SearchIcons\.js/ }), new webpack.ProvidePlugin({ - // required by enzyme > cheerio > parse5 > util + // required by code accessing `process.env` in the browser process: 'process/browser.js', }), ], @@ -57,10 +57,8 @@ module.exports = { fallback: { // Exclude polyfill and treat 'fs' as an empty module since it is not required. next -> gzip-size relies on it. fs: false, - // needed by enzyme > cheerio + // Exclude polyfill and treat 'stream' as an empty module since it is not required. next -> gzip-size relies on it. stream: false, - // required by enzyme > cheerio > parse5 - util: require.resolve('util/'), // Exclude polyfill and treat 'zlib' as an empty module since it is not required. next -> gzip-size relies on it. zlib: false, },