From af5df53da473f941a9e9c37943df27ba99abb171 Mon Sep 17 00:00:00 2001 From: Andrew Huth Date: Wed, 29 Nov 2023 10:56:52 -0500 Subject: [PATCH] chore: add @testing-library/jest-dom --- jest.common.config.js | 2 +- jest.setup.ts | 2 ++ package.json | 1 + packages/components/tsconfig.json | 5 ++-- tsconfig.json | 2 +- yarn.lock | 38 ++++++++++++++++++++++++++++++- 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 jest.setup.ts diff --git a/jest.common.config.js b/jest.common.config.js index d19da4d65..b7548ebf6 100644 --- a/jest.common.config.js +++ b/jest.common.config.js @@ -1,7 +1,7 @@ module.exports = { moduleDirectories: ["node_modules", ""], preset: "ts-jest", - setupFiles: ["jest-canvas-mock", "../../intersectionObserverMock.js"], + setupFilesAfterEnv: ["jest-canvas-mock", "../../jest.setup.ts"], testEnvironment: "jsdom", transform: { "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": diff --git a/jest.setup.ts b/jest.setup.ts new file mode 100644 index 000000000..79a4abada --- /dev/null +++ b/jest.setup.ts @@ -0,0 +1,2 @@ +import "@testing-library/jest-dom"; +import "./intersectionObserverMock"; diff --git a/package.json b/package.json index 7d3a447dd..39754cbba 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@svgr/rollup": "^8.0.1", "@svgr/webpack": "^8.0.1", "@testing-library/dom": "^9.2.0", + "@testing-library/jest-dom": "^6.1.4", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^14.4.3", "@types/babel__core": "^7.20.1", diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index d523cf04f..7c8273419 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -7,10 +7,11 @@ }, "include": [ "src/**/*", - "../../.eslintrc.js" + "../../.eslintrc.js", + "../../jest.setup.ts" ], "exclude": [ "node_modules" ], "references": [] -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 891a98cb4..09a502c01 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -57,7 +57,7 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ "skipLibCheck": true }, - "include": ["packages/**/src/**/*", ".eslintrc.js"], + "include": ["packages/**/src/**/*", ".eslintrc.js", "jest.setup.ts"], "exclude": ["**/node_modules", "node_modules"], "references": [ { diff --git a/yarn.lock b/yarn.lock index ba59fddde..e0bb5d531 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adobe/css-tools@^4.3.1": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.1.tgz#abfccb8ca78075a2b6187345c26243c1a0842f28" + integrity sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg== + "@ampproject/remapping@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" @@ -2138,6 +2143,13 @@ dependencies: regenerator-runtime "^0.13.11" +"@babel/runtime@^7.9.2": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.5.tgz#11edb98f8aeec529b82b211028177679144242db" + integrity sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.3.3": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8" @@ -5854,6 +5866,20 @@ lz-string "^1.5.0" pretty-format "^27.0.2" +"@testing-library/jest-dom@^6.1.4": + version "6.1.4" + resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.1.4.tgz#cf0835c33bc5ef00befb9e672b1e3e6a710e30e3" + integrity sha512-wpoYrCYwSZ5/AxcrjLxJmCU6I5QAJXslEeSiMQqaWmP2Kzpd1LvF/qxmAIW2qposULGWq2gw30GgVNFLSc2Jnw== + dependencies: + "@adobe/css-tools" "^4.3.1" + "@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" + redent "^3.0.0" + "@testing-library/react@^12.1.2": version "12.1.5" resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.5.tgz#bb248f72f02a5ac9d949dea07279095fa577963b" @@ -8907,6 +8933,11 @@ css-what@^6.0.1, css-what@^6.1.0: resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4" integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== +css.escape@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" + integrity sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg== + cssesc@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" @@ -9292,7 +9323,7 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.9: +dom-accessibility-api@^0.5.6, dom-accessibility-api@^0.5.9: version "0.5.16" resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453" integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg== @@ -16535,6 +16566,11 @@ regenerator-runtime@^0.13.11: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + regenerator-transform@^0.15.1: version "0.15.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.1.tgz#f6c4e99fc1b4591f780db2586328e4d9a9d8dc56"