From 1763ee4be70eeca4b63ecacb3a6ddbfe976d057e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 21:35:43 +0000 Subject: [PATCH 1/6] Update testing-library-related --- package-lock.json | 121 +++++++++++++++++++++++++--------------------- package.json | 8 +-- 2 files changed, 71 insertions(+), 58 deletions(-) diff --git a/package-lock.json b/package-lock.json index 87997543..dcead6b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,8 +32,8 @@ "@rollup/plugin-babel": "6.0.4", "@rollup/plugin-node-resolve": "15.2.3", "@rollup/plugin-terser": "0.4.4", - "@testing-library/dom": "9.3.0", - "@testing-library/jest-dom": "6.0.1", + "@testing-library/dom": "9.3.4", + "@testing-library/jest-dom": "6.4.8", "@types/jest": "29.5.12", "@types/node": "16.18.34", "@types/polka": "0.5.7", @@ -41,10 +41,10 @@ "@typescript-eslint/parser": "7.18.0", "@vue/compiler-sfc": "3.4.34", "ansi-regex": "6.0.1", - "aria-query": "5.1.3", + "aria-query": "5.3.0", "axe-core": "4.10.0", "babel-plugin-un-cjs": "2.6.0", - "dom-accessibility-api": "0.6.1", + "dom-accessibility-api": "0.7.0", "errorstacks": "2.4.1", "es-jest": "2.1.0", "eslint": "8.57.0", @@ -98,10 +98,11 @@ } }, "node_modules/@adobe/css-tools": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", - "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==", - "dev": true + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz", + "integrity": "sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==", + "dev": true, + "license": "MIT" }, "node_modules/@ampproject/remapping": { "version": "2.3.0", @@ -4770,15 +4771,16 @@ } }, "node_modules/@testing-library/dom": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.0.tgz", - "integrity": "sha512-Dffe68pGwI6WlLRYR2I0piIkyole9cSBH5jGQKCGMRpHW5RHCqAUaqc2Kv0tUyd4dU4DLPKhJIjyKOnjv4tuUw==", + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.4.tgz", + "integrity": "sha512-FlS4ZWlp97iiNWig0Muq8p+3rVDjRiYE+YKGbAqXOu9nwJFFOdL00kFpz42M+4huzYi86vAK1sOOfyOG45muIQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", - "aria-query": "^5.0.0", + "aria-query": "5.1.3", "chalk": "^4.1.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", @@ -4793,6 +4795,7 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4802,6 +4805,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -4812,11 +4816,22 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/@testing-library/dom/node_modules/aria-query": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "deep-equal": "^2.0.5" + } + }, "node_modules/@testing-library/dom/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -4833,6 +4848,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -4844,19 +4860,22 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/dom/node_modules/dom-accessibility-api": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/dom/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4866,6 +4885,7 @@ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", @@ -4880,6 +4900,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -4891,13 +4912,15 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/dom/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -4906,44 +4929,25 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.0.1.tgz", - "integrity": "sha512-0hx/AWrJp8EKr8LmC5jrV3Lx8TZySH7McU1Ix2czBPQnLd458CefSEGjZy7w8kaBRA6LhoPkGjoZ3yqSs338IQ==", + "version": "6.4.8", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.4.8.tgz", + "integrity": "sha512-JD0G+Zc38f5MBHA4NgxQMR5XtO5Jx9g86jqturNTt2WUfRmLDIY7iKkWHDCCTiDuFMre6nxAD5wHw9W5kI4rGw==", "dev": true, + "license": "MIT", "dependencies": { - "@adobe/css-tools": "^4.0.1", + "@adobe/css-tools": "^4.4.0", "@babel/runtime": "^7.9.2", "aria-query": "^5.0.0", "chalk": "^3.0.0", "css.escape": "^1.5.1", - "dom-accessibility-api": "^0.5.6", - "lodash": "^4.17.15", + "dom-accessibility-api": "^0.6.3", + "lodash": "^4.17.21", "redent": "^3.0.0" }, "engines": { "node": ">=14", "npm": ">=6", "yarn": ">=1" - }, - "peerDependencies": { - "@jest/globals": ">= 28", - "@types/jest": ">= 28", - "jest": ">= 28", - "vitest": ">= 0.32" - }, - "peerDependenciesMeta": { - "@jest/globals": { - "optional": true - }, - "@types/jest": { - "optional": true - }, - "jest": { - "optional": true - }, - "vitest": { - "optional": true - } } }, "node_modules/@testing-library/jest-dom/node_modules/ansi-styles": { @@ -4951,6 +4955,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -4966,6 +4971,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -4979,6 +4985,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -4990,19 +4997,22 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", - "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", - "dev": true + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", + "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", + "dev": true, + "license": "MIT" }, "node_modules/@testing-library/jest-dom/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5012,6 +5022,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -6273,12 +6284,13 @@ } }, "node_modules/aria-query": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", - "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "deep-equal": "^2.0.5" + "dequal": "^2.0.3" } }, "node_modules/array-buffer-byte-length": { @@ -8012,10 +8024,11 @@ } }, "node_modules/dom-accessibility-api": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.1.tgz", - "integrity": "sha512-WbiG8jCZESbcSwxLmbUiv3WZurc6H4opBIbBkBe/I3OSZvWCXXj+wxPueWodM/p4gegM1CqEr0iFY5DqyrncxA==", - "dev": true + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.7.0.tgz", + "integrity": "sha512-LjjdFmd9AITAet3Hy6Y6rwB7Sq1+x5NiwbOpnkLHC1bCXJqJKiV9DyppSSWobuSKvjKXt9G2u3hW402MPt6m+g==", + "dev": true, + "license": "MIT" }, "node_modules/dom-serializer": { "version": "1.4.1", diff --git a/package.json b/package.json index 9785cb55..38b7d0f4 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "@rollup/plugin-babel": "6.0.4", "@rollup/plugin-node-resolve": "15.2.3", "@rollup/plugin-terser": "0.4.4", - "@testing-library/dom": "9.3.0", - "@testing-library/jest-dom": "6.0.1", + "@testing-library/dom": "9.3.4", + "@testing-library/jest-dom": "6.4.8", "@types/jest": "29.5.12", "@types/node": "16.18.34", "@types/polka": "0.5.7", @@ -38,10 +38,10 @@ "@typescript-eslint/parser": "7.18.0", "@vue/compiler-sfc": "3.4.34", "ansi-regex": "6.0.1", - "aria-query": "5.1.3", + "aria-query": "5.3.0", "axe-core": "4.10.0", "babel-plugin-un-cjs": "2.6.0", - "dom-accessibility-api": "0.6.1", + "dom-accessibility-api": "0.7.0", "errorstacks": "2.4.1", "es-jest": "2.1.0", "eslint": "8.57.0", From 4d48bb43505c888c6ee97e5e6cb95ba76e1a8702 Mon Sep 17 00:00:00 2001 From: Caleb Eby Date: Tue, 30 Jul 2024 10:51:01 -0700 Subject: [PATCH 2/6] Think I got all the tests passing --- jest.config.cjs | 2 +- package-lock.json | 584 ++++++++++++------ package.json | 3 +- patches/@testing-library+jest-dom+6.4.8.patch | 20 + src/accessibility/browser.ts | 2 +- src/extend-expect.ts | 8 +- src/jest-dom/rollup.config.js | 23 +- src/jest-dom/to-have-style.js | 82 --- .../toBeEmptyDOMElement.test.ts | 12 +- tests/jest-dom-matchers/toHaveStyle.test.ts | 44 +- tests/testing-library-queries/ByRole.test.ts | 9 + .../variants-of-queries.test.ts | 7 +- tests/user/type.test.ts | 8 +- 13 files changed, 497 insertions(+), 307 deletions(-) create mode 100644 patches/@testing-library+jest-dom+6.4.8.patch delete mode 100644 src/jest-dom/to-have-style.js diff --git a/jest.config.cjs b/jest.config.cjs index 97f098fc..9f160b0f 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -27,5 +27,5 @@ module.exports = { '/node_modules/(?!(\\.pnpm|ansi-regex))', ], setupFilesAfterEnv: ['/jest.setup.ts'], - testTimeout: 10_000, + testTimeout: 30_000, }; diff --git a/package-lock.json b/package-lock.json index dcead6b4..a8cc9a61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "@rollup/plugin-babel": "6.0.4", "@rollup/plugin-node-resolve": "15.2.3", "@rollup/plugin-terser": "0.4.4", - "@testing-library/dom": "9.3.4", + "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "6.4.8", "@types/jest": "29.5.12", "@types/node": "16.18.34", @@ -54,6 +54,7 @@ "liquidjs": "10.16.1", "magic-string": "0.30.11", "mime": "4.0.4", + "patch-package": "^8.0.0", "polka": "0.5.2", "preact": "10.23.1", "prettier": "3.3.3", @@ -4771,23 +4772,22 @@ } }, "node_modules/@testing-library/dom": { - "version": "9.3.4", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.4.tgz", - "integrity": "sha512-FlS4ZWlp97iiNWig0Muq8p+3rVDjRiYE+YKGbAqXOu9nwJFFOdL00kFpz42M+4huzYi86vAK1sOOfyOG45muIQ==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", + "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", "dev": true, - "license": "MIT", "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", - "aria-query": "5.1.3", + "aria-query": "5.3.0", "chalk": "^4.1.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "pretty-format": "^27.0.2" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/@testing-library/dom/node_modules/ansi-regex": { @@ -4816,16 +4816,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/@testing-library/dom/node_modules/aria-query": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", - "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "deep-equal": "^2.0.5" - } - }, "node_modules/@testing-library/dom/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -6108,6 +6098,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true + }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -6407,6 +6403,15 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -7000,13 +7005,19 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -7828,35 +7839,6 @@ } } }, - "node_modules/deep-equal": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.1.tgz", - "integrity": "sha512-lKdkdV6EOGoVn65XaOsPdH4rMxTZOnmFyuIkMjM1i5HHCbfjC97dawgTAy0deYNfuqUqW+Q5VrVaQYtUpSd6yQ==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.0", - "call-bind": "^1.0.2", - "es-get-iterator": "^1.1.3", - "get-intrinsic": "^1.2.0", - "is-arguments": "^1.1.1", - "is-array-buffer": "^3.0.2", - "is-date-object": "^1.0.5", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.2", - "isarray": "^2.0.5", - "object-is": "^1.1.5", - "object-keys": "^1.1.1", - "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.5.0", - "side-channel": "^1.0.4", - "which-boxed-primitive": "^1.0.2", - "which-collection": "^1.0.1", - "which-typed-array": "^1.1.9" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -7878,6 +7860,23 @@ "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", "dev": true }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", @@ -8259,24 +8258,25 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-get-iterator": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", - "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", - "has-symbols": "^1.0.3", - "is-arguments": "^1.1.1", - "is-map": "^2.0.2", - "is-set": "^2.0.2", - "is-string": "^1.0.7", - "isarray": "^2.0.5", - "stop-iteration-iterator": "^1.0.0" + "get-intrinsic": "^1.2.4" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" } }, "node_modules/es-jest": { @@ -9352,6 +9352,15 @@ "node": ">=8" } }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "dependencies": { + "micromatch": "^4.0.2" + } + }, "node_modules/find-yarn-workspace-root2": { "version": "1.2.16", "resolved": "https://registry.npmjs.org/find-yarn-workspace-root2/-/find-yarn-workspace-root2-1.2.16.tgz", @@ -9466,9 +9475,12 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/function.prototype.name": { "version": "1.1.5", @@ -9523,15 +9535,19 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9826,12 +9842,12 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.1" + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9882,6 +9898,18 @@ "integrity": "sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==", "dev": true }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", @@ -10188,22 +10216,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-array-buffer": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", @@ -10316,6 +10328,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-empty": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-empty/-/is-empty-1.2.0.tgz", @@ -10373,15 +10400,6 @@ "node": ">=8" } }, - "node_modules/is-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", - "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -10493,15 +10511,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-set": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", - "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", @@ -10589,15 +10598,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-weakmap": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", - "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -10610,19 +10610,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-weakset": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", - "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -10633,6 +10620,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -12709,6 +12708,24 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -12736,6 +12753,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -12745,6 +12771,15 @@ "json-buffer": "3.0.0" } }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -14188,22 +14223,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -14301,6 +14320,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -14644,6 +14679,209 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/patch-package": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", + "dev": true, + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/patch-package/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/patch-package/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/patch-package/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/patch-package/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/patch-package/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/patch-package/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/patch-package/node_modules/yaml": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", + "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -16734,6 +16972,23 @@ "randombytes": "^2.1.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -17083,18 +17338,6 @@ "node": ">=8" } }, - "node_modules/stop-iteration-iterator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", - "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", - "dev": true, - "dependencies": { - "internal-slot": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/streamx": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.18.0.tgz", @@ -18647,21 +18890,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/which-collection": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", - "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", - "dev": true, - "dependencies": { - "is-map": "^2.0.1", - "is-set": "^2.0.1", - "is-weakmap": "^2.0.1", - "is-weakset": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/which-pm": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-2.0.0.tgz", diff --git a/package.json b/package.json index 38b7d0f4..e58862d9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@rollup/plugin-babel": "6.0.4", "@rollup/plugin-node-resolve": "15.2.3", "@rollup/plugin-terser": "0.4.4", - "@testing-library/dom": "9.3.4", + "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "6.4.8", "@types/jest": "29.5.12", "@types/node": "16.18.34", @@ -51,6 +51,7 @@ "liquidjs": "10.16.1", "magic-string": "0.30.11", "mime": "4.0.4", + "patch-package": "^8.0.0", "polka": "0.5.2", "preact": "10.23.1", "prettier": "3.3.3", diff --git a/patches/@testing-library+jest-dom+6.4.8.patch b/patches/@testing-library+jest-dom+6.4.8.patch new file mode 100644 index 00000000..79c563c4 --- /dev/null +++ b/patches/@testing-library+jest-dom+6.4.8.patch @@ -0,0 +1,20 @@ +diff --git a/node_modules/@testing-library/jest-dom/dist/matchers-15a34310.mjs b/node_modules/@testing-library/jest-dom/dist/matchers-15a34310.mjs +index e98c067..ff110fb 100644 +--- a/node_modules/@testing-library/jest-dom/dist/matchers-15a34310.mjs ++++ b/node_modules/@testing-library/jest-dom/dist/matchers-15a34310.mjs +@@ -927,10 +927,14 @@ function getStyleDeclaration(document, css) { + + // The next block is necessary to normalize colors + const copy = document.createElement('div'); ++ const {getComputedStyle} = document.defaultView; ++ document.body.appendChild(copy) + Object.keys(css).forEach(property => { + copy.style[property] = css[property]; +- styles[property] = copy.style[property]; ++ const computed = getComputedStyle(copy) ++ styles[property] = computed[property] || computed.getPropertyValue(property); + }); ++ document.body.removeChild(copy) + + return styles + } diff --git a/src/accessibility/browser.ts b/src/accessibility/browser.ts index f49077c9..2188458e 100644 --- a/src/accessibility/browser.ts +++ b/src/accessibility/browser.ts @@ -12,7 +12,7 @@ import type { AccessibilityTreeOptions } from './index.js'; export * as colors from 'kolorist'; export { printElement } from '../serialize/index.js'; -// We haver to tell kolorist to print the colors +// We have to tell kolorist to print the colors // because by default it won't since we are in the browser // (the colored message gets sent to node to be printed) colors.options.enabled = true; diff --git a/src/extend-expect.ts b/src/extend-expect.ts index 683608d9..8b3abf23 100644 --- a/src/extend-expect.ts +++ b/src/extend-expect.ts @@ -20,6 +20,7 @@ const methods = [ 'toContainElement', 'toContainHTML', 'toHaveAccessibleDescription', + // 'toHaveAccessibleErrorMessage', 'toHaveAccessibleName', 'toHaveTextContent', 'toHaveAttribute', @@ -37,6 +38,7 @@ const methods = [ 'toHaveDisplayValue', 'toBeChecked', 'toBePartiallyChecked', + // Below here are deprecated matchers 'toHaveErrorMessage', ] as const; @@ -351,10 +353,9 @@ declare global { toHaveFormValues(expectedValues: Record): Promise; /** * Check if an element has specific css properties applied - * Unlike jest-dom, pleasantest does not support specifying expected styles as strings, they must be specified as an object. * https://github.com/testing-library/jest-dom#tohavestyle */ - toHaveStyle(css: Record): Promise; + toHaveStyle(css: string | Record): Promise; /** * Check whether the given element has a text content * https://github.com/testing-library/jest-dom#tohavetextcontent @@ -392,7 +393,6 @@ declare global { /** * Check whether the given element is partially checked. * It accepts an `input` of type `checkbox` and elements with a `role` of `checkbox` with `aria-checked="mixed"`, or input of type `checkbox` with `indeterminate` set to `true` - * https://github.com/testing-library/jest-dom#tobepartiallychecked */ toBePartiallyChecked(): Promise; @@ -400,6 +400,8 @@ declare global { /** * Check whether the given element has an ARIA error message (via aria-errormessage) * https://github.com/testing-library/jest-dom#tohaveerrormessage + * + * @deprecated - use `toHaveAccessibleErrorMessage` instead */ toHaveErrorMessage(text: string | RegExp): Promise; } diff --git a/src/jest-dom/rollup.config.js b/src/jest-dom/rollup.config.js index 03cddf08..9a3f32da 100644 --- a/src/jest-dom/rollup.config.js +++ b/src/jest-dom/rollup.config.js @@ -1,4 +1,5 @@ -import { createRequire } from 'node:module'; +import * as childProcess from 'node:child_process'; +import { promisify } from 'node:util'; import babel from '@rollup/plugin-babel'; import nodeResolve from '@rollup/plugin-node-resolve'; @@ -6,25 +7,25 @@ import terser from '@rollup/plugin-terser'; import { rollupPluginDomAccessibilityApi } from '../rollup-plugin-dom-accessibility-api.js'; -const require = createRequire(import.meta.url); +const exec = promisify(childProcess.exec); const extensions = ['.js', '.jsx', '.es6', '.es', '.mjs', '.ts', '.tsx']; +const { stdout, stderr } = await exec('./node_modules/.bin/patch-package'); +process.stdout.write(stdout); +process.stderr.write(stderr); + const stubs = { - [require.resolve('@testing-library/jest-dom/dist/to-have-style')]: ` - export { toHaveStyle } from "${require.resolve('./to-have-style')}" + chalk: ` + import * as colors from 'kolorist' + export default colors `, // No need for polyfill in real browser 'css.escape': ` const escape = (str) => CSS.escape(str) export default escape `, - 'aria-query': ` - export const roles = { - 'get': () => ({ props: { 'aria-checked': true } }) - } - `, - 'lodash/isEqualWith': ` + 'lodash/isEqualWith.js': ` import { isEqual } from 'smoldash' export default (value, other, customizer) => { const result = customizer(value, other) @@ -85,7 +86,7 @@ const config = { keep_fnames: /^to/, }), ], - external: ['@adobe/css-tools'], + external: [], treeshake: { moduleSideEffects: 'no-external' }, output: { file: 'dist/jest-dom.js' }, }; diff --git a/src/jest-dom/to-have-style.js b/src/jest-dom/to-have-style.js deleted file mode 100644 index e6e21f45..00000000 --- a/src/jest-dom/to-have-style.js +++ /dev/null @@ -1,82 +0,0 @@ -// eslint-disable-next-line @cloudfour/n/no-missing-import -import { checkHtmlElement } from '@testing-library/jest-dom/dist/utils'; - -function getStyleDeclaration(document, css) { - const styles = {}; - const { getComputedStyle } = document.defaultView; - // Necessary to normalize colors - const copy = document.createElement('div'); - // Has to be in the document for styles to be applied - document.body.append(copy); - for (const property of Object.keys(css)) { - copy.style[property] = css[property]; - styles[property] = getComputedStyle(copy)[property] || css[property]; - } - - copy.remove(); - return styles; -} - -function isSubset(styles, computedStyle) { - return ( - Object.keys(styles).length > 0 && - Object.entries(styles).every( - ([prop, value]) => - computedStyle[prop] === value || - computedStyle.getPropertyValue(prop.toLowerCase()) === value, - ) - ); -} - -function printoutStyles(styles) { - return Object.keys(styles) - .sort() - .map((prop) => `${prop}: ${styles[prop]};`) - .join('\n'); -} - -/** - * @param {HTMLElement} htmlElement - * @param {string} css - * @this {jest.MatcherUtils} - */ -export function toHaveStyle(htmlElement, css) { - if (typeof css === 'string') - throw new Error( - `pleasantest only supports specifying expected styles as objects, received ${JSON.stringify( - css, - )}`, - ); - checkHtmlElement(htmlElement, toHaveStyle, this); - const { getComputedStyle } = htmlElement.ownerDocument.defaultView; - - const expected = getStyleDeclaration(htmlElement.ownerDocument, css); - const received = getComputedStyle(htmlElement); - - return { - pass: isSubset(expected, received), - message: () => { - const matcher = `${this.isNot ? '.not' : ''}.toHaveStyle`; - const matcherHint = this.utils.matcherHint(matcher, 'element', ''); - if (this.isNot) { - return ( - `${matcherHint}\n\n` + - `Expected ${this.utils.RECEIVED_COLOR( - 'element', - )} to not have styles:` + - `\n\n${this.utils.RECEIVED_COLOR(printoutStyles(expected))}` - ); - } - - const receivedSubset = {}; - for (const prop of Object.keys(expected)) { - receivedSubset[prop] = received[prop]; - } - - return `${matcherHint}\n\n${this.utils.diff( - printoutStyles(expected), - printoutStyles(receivedSubset), - )}`; - }, - }; -} diff --git a/tests/jest-dom-matchers/toBeEmptyDOMElement.test.ts b/tests/jest-dom-matchers/toBeEmptyDOMElement.test.ts index d7a98875..a898df02 100644 --- a/tests/jest-dom-matchers/toBeEmptyDOMElement.test.ts +++ b/tests/jest-dom-matchers/toBeEmptyDOMElement.test.ts @@ -14,12 +14,12 @@ test( await expect(notempty).not.toBeEmptyDOMElement(); await expect(expect(notempty).toBeEmptyDOMElement()).rejects .toThrowErrorMatchingInlineSnapshot(` - "expect(element).toBeEmptyDOMElement() + "expect(element).toBeEmptyDOMElement() - Received: - 
-
-
" - `); + Received: + " + 
 +  "" + `); }), ); diff --git a/tests/jest-dom-matchers/toHaveStyle.test.ts b/tests/jest-dom-matchers/toHaveStyle.test.ts index 8e7f7794..a6e974e2 100644 --- a/tests/jest-dom-matchers/toHaveStyle.test.ts +++ b/tests/jest-dom-matchers/toHaveStyle.test.ts @@ -14,26 +14,35 @@ test( const button = await screen.getByTestId('delete-button'); - await expect( - expect(button).toHaveStyle('display: none' as any), - ).rejects.toThrowErrorMatchingInlineSnapshot( - `"pleasantest only supports specifying expected styles as objects, received "display: none""`, - ); + await expect(button).toHaveStyle('display: none'); + await expect(button).not.toHaveStyle('display: grid'); await expect(button).toHaveStyle({ display: 'none' }); await expect(expect(button).toHaveStyle({ display: 'invalid' })).rejects .toThrowErrorMatchingInlineSnapshot(` - "expect(element).toHaveStyle() + "expect(element).toHaveStyle() - - Expected - + Received + - Expected + + Received - - display: block; - + display: none;" - `); + - display: block; + + display: none;" + `); + await expect(button).toHaveStyle(` + background-color: red; + display: none; + `); + await expect(button).toHaveStyle({ + 'background-color': 'red', + display: 'none', + }); await expect(button).toHaveStyle({ backgroundColor: 'red', display: 'none', }); + await expect(button).not.toHaveStyle({ + 'background-color': 'blue', + display: 'none', + }); await expect(button).not.toHaveStyle({ backgroundColor: 'blue', display: 'none', @@ -44,14 +53,13 @@ test( display: 'none', }), ).rejects.toThrowErrorMatchingInlineSnapshot(` - "expect(element).toHaveStyle() + "expect(element).toHaveStyle() - - Expected - + Received + - Expected + + Received - - backgroundColor: rgb(0, 0, 255); - + backgroundColor: rgb(255, 0, 0); -  display: none;" - `); + - backgroundColor: rgb(0, 0, 255); +  display: none;" + `); }), ); diff --git a/tests/testing-library-queries/ByRole.test.ts b/tests/testing-library-queries/ByRole.test.ts index 477bcac9..34211623 100644 --- a/tests/testing-library-queries/ByRole.test.ts +++ b/tests/testing-library-queries/ByRole.test.ts @@ -33,7 +33,10 @@ test( document: Name "": + + [...] [...] + -------------------------------------------------- heading: @@ -54,6 +57,12 @@ test( -------------------------------------------------- + paragraph: + + Name "": +

Items in the trash will be permanently removed after 30 days.

+ + -------------------------------------------------- Within: #document" `); diff --git a/tests/testing-library-queries/variants-of-queries.test.ts b/tests/testing-library-queries/variants-of-queries.test.ts index c0721ca5..ab628c42 100644 --- a/tests/testing-library-queries/variants-of-queries.test.ts +++ b/tests/testing-library-queries/variants-of-queries.test.ts @@ -82,9 +82,12 @@ test( document: Name "": + + [...] -

Hi

- +

Hi

+ + -------------------------------------------------- heading: diff --git a/tests/user/type.test.ts b/tests/user/type.test.ts index 42f042c3..03043590 100644 --- a/tests/user/type.test.ts +++ b/tests/user/type.test.ts @@ -150,11 +150,11 @@ test( await utils.injectHTML(``); const input = await screen.getByRole('textbox'); let startTime = Date.now(); - await user.type(input, '123'); - expect(Date.now() - startTime).toBeLessThan(100); + await user.type(input, '1234567890'); + expect(Date.now() - startTime).toBeLessThan(200); startTime = Date.now(); - await user.type(input, '123', { delay: 50 }); - expect(Date.now() - startTime).toBeGreaterThan(150); + await user.type(input, '1234567890', { delay: 100 }); + expect(Date.now() - startTime).toBeGreaterThan(1000); }), ); From 048e438900cb165792152debd0508119a2a48ec9 Mon Sep 17 00:00:00 2001 From: Caleb Eby Date: Tue, 30 Jul 2024 10:54:31 -0700 Subject: [PATCH 3/6] Lint fix --- src/jest-dom/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jest-dom/index.ts b/src/jest-dom/index.ts index 780483b7..49cea45b 100644 --- a/src/jest-dom/index.ts +++ b/src/jest-dom/index.ts @@ -1,5 +1,6 @@ import { addToElementCache, serialize } from '../serialize/index.js'; // @ts-expect-error types are not provided for this sub-path import +// eslint-disable-next-line @cloudfour/n/file-extension-in-import export * from '@testing-library/jest-dom/matchers'; export { reviveElementsInString, From e09592b7c2869019ed51de3b74bc54da3328a4c3 Mon Sep 17 00:00:00 2001 From: Caleb Eby Date: Tue, 30 Jul 2024 12:30:15 -0700 Subject: [PATCH 4/6] Update matchers list, changeset, tests --- .changeset/fuzzy-boxes-scream.md | 9 + README.md | 3 +- src/extend-expect.ts | 310 ++++++++++++------ ...s => toHaveAccessibleErrorMessage.test.ts} | 30 +- tests/jest-dom-matchers/toHaveRole.test.ts | 50 +++ 5 files changed, 286 insertions(+), 116 deletions(-) create mode 100644 .changeset/fuzzy-boxes-scream.md rename tests/jest-dom-matchers/{toHaveErrorMessage.test.ts => toHaveAccessibleErrorMessage.test.ts} (55%) create mode 100644 tests/jest-dom-matchers/toHaveRole.test.ts diff --git a/.changeset/fuzzy-boxes-scream.md b/.changeset/fuzzy-boxes-scream.md new file mode 100644 index 00000000..87f807b5 --- /dev/null +++ b/.changeset/fuzzy-boxes-scream.md @@ -0,0 +1,9 @@ +--- +'pleasantest': major +--- + +Update jest-dom matchers. We are now using `@testing-library/jest-dom@6`. +We now support all of the jest-dom matchers, except for the deprecated ones. + +- `toHaveErrorMessage` was deprecated, use `toHaveAccessibleErrorMessage` instead +- `toHaveRole` was added \ No newline at end of file diff --git a/README.md b/README.md index ebe2f121..8d81b9a1 100644 --- a/README.md +++ b/README.md @@ -827,7 +827,8 @@ Pleasantest adds [`jest-dom`'s matchers](https://github.com/testing-library/jest List of matchers: -[`toBeDisabled`](https://github.com/testing-library/jest-dom#tobedisabled), [`toBeEnabled`](https://github.com/testing-library/jest-dom#tobeenabled), [`toBeEmptyDOMElement`](https://github.com/testing-library/jest-dom#tobeemptydomelement), [`toBeInTheDocument`](https://github.com/testing-library/jest-dom#tobeinthedocument), [`toBeInvalid`](https://github.com/testing-library/jest-dom#tobeinvalid), [`toBeRequired`](https://github.com/testing-library/jest-dom#toberequired), [`toBeValid`](https://github.com/testing-library/jest-dom#tobevalid), [`toBeVisible`](https://github.com/testing-library/jest-dom#tobevisible), [`toContainElement`](https://github.com/testing-library/jest-dom#tocontainelement), [`toContainHTML`](https://github.com/testing-library/jest-dom#tocontainhtml), [`toHaveAccessibleDescription`](https://github.com/testing-library/jest-dom#tohaveaccessibledescription), [`toHaveAccessibleName`](https://github.com/testing-library/jest-dom#tohaveaccessiblename), [`toHaveAttribute`](https://github.com/testing-library/jest-dom#tohaveattribute), [`toHaveClass`](https://github.com/testing-library/jest-dom#tohaveclass), [`toHaveFocus`](https://github.com/testing-library/jest-dom#tohavefocus), [`toHaveFormValues`](https://github.com/testing-library/jest-dom#tohaveformvalues), [`toHaveStyle`](https://github.com/testing-library/jest-dom#tohavestyle), [`toHaveTextContent`](https://github.com/testing-library/jest-dom#tohavetextcontent), [`toHaveValue`](https://github.com/testing-library/jest-dom#tohavevalue), [`toHaveDisplayValue`](https://github.com/testing-library/jest-dom#tohavedisplayvalue), [`toBeChecked`](https://github.com/testing-library/jest-dom#tobechecked), [`toBePartiallyChecked`](https://github.com/testing-library/jest-dom#tobepartiallychecked), [`toHaveErrorMessage`](https://github.com/testing-library/jest-dom#tohaveerrormessage). +[`toBeDisabled`](https://github.com/testing-library/jest-dom#tobedisabled), [`toBeEnabled`](https://github.com/testing-library/jest-dom#tobeenabled), [`toBeEmptyDOMElement`](https://github.com/testing-library/jest-dom#tobeemptydomelement), [`toBeInTheDocument`](https://github.com/testing-library/jest-dom#tobeinthedocument), [`toBeInvalid`](https://github.com/testing-library/jest-dom#tobeinvalid), [`toBeRequired`](https://github.com/testing-library/jest-dom#toberequired), [`toBeValid`](https://github.com/testing-library/jest-dom#tobevalid), [`toBeVisible`](https://github.com/testing-library/jest-dom#tobevisible), [`toContainElement`](https://github.com/testing-library/jest-dom#tocontainelement), [`toContainHTML`](https://github.com/testing-library/jest-dom#tocontainhtml), [`toHaveAccessibleDescription`](https://github.com/testing-library/jest-dom#tohaveaccessibledescription), [`toHaveAccessibleErrorMessage`](https://github.com/testing-library/jest-dom#tohaveaccessibleerrormessage), [`toHaveAccessibleName`](https://github.com/testing-library/jest-dom#tohaveaccessiblename), [`toHaveAttribute`](https://github.com/testing-library/jest-dom#tohaveattribute), [`toHaveClass`](https://github.com/testing-library/jest-dom#tohaveclass), [`toHaveFocus`](https://github.com/testing-library/jest-dom#tohavefocus), [`toHaveFormValues`](https://github.com/testing-library/jest-dom#tohaveformvalues), [`toHaveStyle`](https://github.com/testing-library/jest-dom#tohavestyle), [`toHaveTextContent`](https://github.com/testing-library/jest-dom#tohavetextcontent), [`toHaveValue`](https://github.com/testing-library/jest-dom#tohavevalue), [`toHaveDisplayValue`](https://github.com/testing-library/jest-dom#tohavedisplayvalue), [`toBeChecked`](https://github.com/testing-library/jest-dom#tobechecked), [`toBePartiallyChecked`](https://github.com/testing-library/jest-dom#tobepartiallychecked), [`toHaveRole`](https://github.com/testing-library/jest-dom#tohaverole) + . > :warning: **Don't forget to `await` matchers!** This is necessary because the matchers execute in the browser. If you forget, your matchers may execute after your test finishes, and you may get obscure errors. diff --git a/src/extend-expect.ts b/src/extend-expect.ts index 8b3abf23..0b83227f 100644 --- a/src/extend-expect.ts +++ b/src/extend-expect.ts @@ -1,3 +1,6 @@ +// eslint-disable-next-line @cloudfour/n/file-extension-in-import +import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers'; +import type { ARIARole } from 'aria-query'; import type { ElementHandle, JSHandle } from 'puppeteer'; import { @@ -14,33 +17,43 @@ import { removeFuncFromStackTrace, } from './utils.js'; -const methods = [ - 'toBeInTheDocument', - 'toBeEmptyDOMElement', - 'toContainElement', - 'toContainHTML', - 'toHaveAccessibleDescription', - // 'toHaveAccessibleErrorMessage', - 'toHaveAccessibleName', - 'toHaveTextContent', - 'toHaveAttribute', - 'toHaveClass', - 'toHaveStyle', - 'toHaveFocus', - 'toHaveFormValues', - 'toBeVisible', - 'toBeDisabled', - 'toBeEnabled', - 'toBeRequired', - 'toBeInvalid', - 'toBeValid', - 'toHaveValue', - 'toHaveDisplayValue', - 'toBeChecked', - 'toBePartiallyChecked', - // Below here are deprecated matchers - 'toHaveErrorMessage', -] as const; +// We are checking both objects here to make sure +// that we don't forget to define the types for any matchers either +// (at the bottom of this file) +type MatcherNames = Exclude< + keyof TestingLibraryMatchers, + // Exclude deprecated matchers, we don't need to include those. + 'toBeInTheDOM' | 'toBeEmpty' | 'toHaveDescription' | 'toHaveErrorMessage' +>; + +// Using an object here so that TS will tell us if there are any matchers +// added to jest-dom upstream but that are missing from this list +const matcherNames: { [K in MatcherNames]: true } = { + toBeDisabled: true, + toBeEnabled: true, + toBeEmptyDOMElement: true, + toBeInTheDocument: true, + toBeInvalid: true, + toBeRequired: true, + toBeValid: true, + toBeVisible: true, + toContainElement: true, + toContainHTML: true, + toHaveAccessibleDescription: true, + toHaveAccessibleErrorMessage: true, + toHaveAccessibleName: true, + toHaveAttribute: true, + toHaveClass: true, + toHaveFocus: true, + toHaveFormValues: true, + toHaveStyle: true, + toHaveTextContent: true, + toHaveValue: true, + toHaveDisplayValue: true, + toBeChecked: true, + toBePartiallyChecked: true, + toHaveRole: true, +} satisfies { [K in keyof jest.Matchers]?: true }; // Ensure that our list _only_ contains methods we've defined types for const isJSHandle = (input: unknown): input is JSHandle => { if (typeof input !== 'object' || !input) return false; @@ -49,7 +62,7 @@ const isJSHandle = (input: unknown): input is JSHandle => { }; const matchers: jest.ExpectExtendMap = Object.fromEntries( - methods.map((methodName) => { + Object.keys(matcherNames).map((methodName) => { const matcher = async function ( this: jest.MatcherUtils, elementHandle: ElementHandle | null, @@ -253,157 +266,254 @@ const runJestUtilsInNode = (message: string, context: jest.MatcherContext) => { expect.extend(matchers); -// These type definitions are incomplete, only including methods we've tested -// More can be added from https://unpkg.com/@types/testing-library__jest-dom/index.d.ts -// You can copy-paste and change the return types to promises declare global { // eslint-disable-next-line @cloudfour/typescript-eslint/no-namespace namespace jest { interface Matchers { /** - * Check whether an element is disabled from the user's perspective. - * https://github.com/testing-library/jest-dom#tobedisabled + * Assert whether an element is present in the document or not. + * + * https://github.com/testing-library/jest-dom#tobeinthedocument */ - toBeDisabled(): Promise; + toBeInTheDocument(): Promise; /** - * Check whether an element is not disabled from the user's perspective. - * https://github.com/testing-library/jest-dom#tobeenabled - * Same as .not.toBeDisabled() + * This allows you to check if an element is currently visible to the user. + * + * An element is visible if **all** the following conditions are met: + * it does not have its css property display set to none + * it does not have its css property visibility set to either hidden or collapse + * it does not have its css property opacity set to 0 + * its parent element is also visible (and so on up to the top of the DOM tree) + * it does not have the hidden attribute + * if `
` it has the open attribute + * + * https://github.com/testing-library/jest-dom#tobevisible */ - toBeEnabled(): Promise; + toBeVisible(): Promise; /** * Assert whether an element has content or not. + * * https://github.com/testing-library/jest-dom#tobeemptydomelement */ toBeEmptyDOMElement(): Promise; /** - * Assert whether an element is present in the document or not. - * https://github.com/testing-library/jest-dom#tobeinthedocument + * Allows you to check whether an element is disabled from the user's perspective. + * + * Matches if the element is a form control and the `disabled` attribute is specified on this element or the + * element is a descendant of a form element with a `disabled` attribute. + * + * https://github.com/testing-library/jest-dom#tobedisabled */ - toBeInTheDocument(): Promise; + toBeDisabled(): Promise; + /** + * Allows you to check whether an element is not disabled from the user's perspective. + * + * Works like `not.toBeDisabled()`. + * + * Use this matcher to avoid double negation in your tests. + * + * https://github.com/testing-library/jest-dom#tobeenabled + */ + toBeEnabled(): Promise; /** - * Check if the value of an element is currently invalid. - * Uses [HTML5 Constraint Validation](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation) and checks for `aria-invalid`. + * Check if a form element, or the entire `form`, is currently invalid. + * + * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no + * value or a value of "true", or if the result of `checkValidity()` is false. + * * https://github.com/testing-library/jest-dom#tobeinvalid */ toBeInvalid(): Promise; /** - * Check if a form element is currently required. + * This allows you to check if a form element is currently required. + * + * An element is required if it is having a `required` or `aria-required="true"` attribute. + * * https://github.com/testing-library/jest-dom#toberequired */ toBeRequired(): Promise; /** - * Check if the value of an element is currently valid. - * Uses [HTML5 Constraint Validation](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation) and checks for `aria-invalid`. + * Allows you to check if a form element is currently required. + * + * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no + * value or a value of "false", or if the result of `checkValidity()` is true. + * * https://github.com/testing-library/jest-dom#tobevalid */ toBeValid(): Promise; /** - * Check if an element is currently visible to the user. - * https://github.com/testing-library/jest-dom#tobevisible - */ - toBeVisible(): Promise; - /** - * Check if an element contains another element as a descendant. + * Allows you to assert whether an element contains another element as a descendant or not. + * * https://github.com/testing-library/jest-dom#tocontainelement */ toContainElement( element: ElementHandle | null, ): Promise; /** - * Check whether a string representing a HTML element is contained in another element. + * Assert whether a string representing a HTML element is contained in another element. + * * https://github.com/testing-library/jest-dom#tocontainhtml */ - toContainHTML(html: string): Promise; + toContainHTML(htmlText: string): Promise; /** - * Assert that an element has the expected [accessible description](https://www.w3.org/TR/accname-1.1/#dfn-accessible-description). - * You can pass the exact string, or you can make a partial match passing a regular expression - * https://github.com/testing-library/jest-dom#tohaveaccessibledescription - */ - toHaveAccessibleDescription(text?: string | RegExp): Promise; - /** - * Assert that an element has the expected [accessible description](https://www.w3.org/TR/accname-1.1/#dfn-accessible-name). - * It is useful, for instance, to assert that form elements and buttons are properly labelled. - * You can pass the exact string, or you can make a partial match passing a regular expression - * https://github.com/testing-library/jest-dom#tohaveaccessibledescription - */ - toHaveAccessibleName(text?: string | RegExp): Promise; - /** - * Check whether the given element has an attribute or not. - * You can also optionally check that the attribute has a specific expected value + * Allows you to check if a given element has an attribute or not. + * + * You can also optionally check that the attribute has a specific expected value or partial match using + * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or + * [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp). + * * https://github.com/testing-library/jest-dom#tohaveattribute */ - toHaveAttribute(attr: string, value?: string): Promise; + toHaveAttribute(attr: string, value?: unknown): Promise; /** - * Check whether the given element has certain classes within its class attribute. + * Check whether the given element has certain classes within its `class` attribute. + * * You must provide at least one class, unless you are asserting that an element does not have any classes. + * * https://github.com/testing-library/jest-dom#tohaveclass */ - toHaveClass(...classNames: string[]): Promise; + toHaveClass(...classNames: (string | RegExp)[]): Promise; toHaveClass(classNames: string, options?: { exact: boolean }): Promise; /** - * Check whether an element has focus + * This allows you to check whether the given form element has the specified displayed value (the one the + * end user will see). It accepts ,