From 6f57fd08dec9c72be978e66c0374e9fb21261654 Mon Sep 17 00:00:00 2001 From: Jordan Thomson Date: Wed, 18 Dec 2024 23:31:55 +1100 Subject: [PATCH 1/3] bumped some deps --- package.json | 12 ++--- yarn.lock | 131 ++++++++++++++------------------------------------- 2 files changed, 41 insertions(+), 102 deletions(-) diff --git a/package.json b/package.json index 00dc0789e7..f3f10a3786 100644 --- a/package.json +++ b/package.json @@ -81,10 +81,10 @@ "@storybook/addon-notes": "5.3.21", "@storybook/addon-options": "5.3.21", "@storybook/react": "6.4.9", - "@testing-library/react": "12.1.2", - "@testing-library/react-hooks": "7.0.2", + "@testing-library/react": "16.1.0", + "@testing-library/react-hooks": "8.0.1", "@types/jest": "27.5.2", - "@types/react": "17.0.0", + "@types/react": "19.0.1", "@typescript-eslint/eslint-plugin": "5.62.0", "@typescript-eslint/parser": "5.62.0", "babel-core": "6.26.3", @@ -110,8 +110,8 @@ "markdown-loader": "6.0.0", "prettier": "2.3.0", "raf-stub": "3.0.0", - "react": "17.0.2", - "react-dom": "17.0.2", + "react": "19.0.0", + "react-dom": "19.0.0", "react-frame-component": "5.2.7", "react-spring": "9.7.4", "react-test-renderer": "17.0.2", @@ -124,7 +124,7 @@ "ts-jest": "26.5.6", "ts-loader": "8.4.0", "ts-node": "10.9.2", - "typescript": "4.1.5" + "typescript": "5.7.2" }, "config": { "commitizen": { diff --git a/yarn.lock b/yarn.lock index 1e6d4daefd..55bde4d17a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2489,14 +2489,6 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime-corejs3@^7.10.2": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.12.5.tgz#ffee91da0eb4c6dae080774e94ba606368e414f4" - integrity sha512-roGr54CsTmNPPzZoCP1AmDXuBoNao7tnSA83TXTwt+UK5QVyh1DIJnrgYRPWKCF2flqZQXwa7Yr8v7VmLzF0YQ== - dependencies: - core-js-pure "^3.0.0" - regenerator-runtime "^0.13.4" - "@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.12.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" @@ -4683,38 +4675,20 @@ resolve-from "^5.0.0" store2 "^2.12.0" -"@testing-library/dom@^8.0.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.2.0.tgz#ac46a1b9d7c81f0d341ae38fb5424b64c27d151e" - integrity sha512-U8cTWENQPHO3QHvxBdfltJ+wC78ytMdg69ASvIdkGdQ/XRg4M9H2vvM3mHddxl+w/fM6NNqzGMwpQoh82v9VIA== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/runtime" "^7.12.5" - "@types/aria-query" "^4.2.0" - aria-query "^4.2.2" - chalk "^4.1.0" - dom-accessibility-api "^0.5.6" - lz-string "^1.4.4" - pretty-format "^27.0.2" - -"@testing-library/react-hooks@7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-7.0.2.tgz#3388d07f562d91e7f2431a4a21b5186062ecfee0" - integrity sha512-dYxpz8u9m4q1TuzfcUApqi8iFfR6R0FaMbr2hjZJy1uC8z+bO/K4v8Gs9eogGKYQop7QsrBTFkv/BCF7MzD2Cg== +"@testing-library/react-hooks@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-8.0.1.tgz#0924bbd5b55e0c0c0502d1754657ada66947ca12" + integrity sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g== dependencies: "@babel/runtime" "^7.12.5" - "@types/react" ">=16.9.0" - "@types/react-dom" ">=16.9.0" - "@types/react-test-renderer" ">=16.9.0" react-error-boundary "^3.1.0" -"@testing-library/react@12.1.2": - version "12.1.2" - resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.2.tgz#f1bc9a45943461fa2a598bb4597df1ae044cfc76" - integrity sha512-ihQiEOklNyHIpo2Y8FREkyD1QAea054U0MVbwH1m8N9TxeFz+KoJ9LkqoKqJlzx2JDm56DVwaJ1r36JYxZM05g== +"@testing-library/react@16.1.0": + version "16.1.0" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.1.0.tgz#aa0c61398bac82eaf89776967e97de41ac742d71" + integrity sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg== dependencies: "@babel/runtime" "^7.12.5" - "@testing-library/dom" "^8.0.0" "@tsconfig/node10@^1.0.7": version "1.0.8" @@ -4754,11 +4728,6 @@ resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== -"@types/aria-query@^4.2.0": - version "4.2.1" - resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.1.tgz#78b5433344e2f92e8b306c06a5622c50c245bf6b" - integrity sha512-S6oPal772qJZHoRZLFc/XoZW2gFvwXusYUmXPXkgxJLuEk2vOt7jc4Yo6z/vtI0EBkbPBVrJJ0B+prLIKiWqHg== - "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.12" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.12.tgz#4d8e9e51eb265552a7e4f1ff2219ab6133bdfb2d" @@ -4980,13 +4949,6 @@ dependencies: "@types/react" "*" -"@types/react-dom@>=16.9.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.0.tgz#b3b691eb956c4b3401777ee67b900cb28415d95a" - integrity sha512-lUqY7OlkF/RbNtD5nIq7ot8NquXrdFrjSOR6+w9a9RFQevGi1oZO1dcJbXMeONAPKtZ2UrZOEJ5UOCVsxbLk/g== - dependencies: - "@types/react" "*" - "@types/react-syntax-highlighter@11.0.4": version "11.0.4" resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-11.0.4.tgz#d86d17697db62f98046874f62fdb3e53a0bbc4cd" @@ -5001,13 +4963,6 @@ dependencies: "@types/react" "*" -"@types/react-test-renderer@>=16.9.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-17.0.0.tgz#9be47b375eeb906fced37049e67284a438d56620" - integrity sha512-nvw+F81OmyzpyIE1S0xWpLonLUZCMewslPuA8BtjSKc5XEbn8zEQBXS7KuOLHTNnSOEM2Pum50gHOoZ62tqTRg== - dependencies: - "@types/react" "*" - "@types/react-textarea-autosize@^4.3.3": version "4.3.5" resolved "https://registry.yarnpkg.com/@types/react-textarea-autosize/-/react-textarea-autosize-4.3.5.tgz#6c4d2753fa1864c98c0b2b517f67bb1f6e4c46de" @@ -5015,7 +4970,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@17.0.0", "@types/react@>=16.9.0": +"@types/react@*": version "17.0.0" resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.0.tgz#5af3eb7fad2807092f0046a1302b7823e27919b8" integrity sha512-aj/L7RIMsRlWML3YB6KZiXB3fV2t41+5RBGYF8z+tAKU43Px8C3cYUZsDvf1/+Bm4FK21QWBrDutu8ZJ/70qOw== @@ -5023,6 +4978,13 @@ "@types/prop-types" "*" csstype "^3.0.2" +"@types/react@19.0.1": + version "19.0.1" + resolved "https://registry.yarnpkg.com/@types/react/-/react-19.0.1.tgz#a000d5b78f473732a08cecbead0f3751e550b3df" + integrity sha512-YW6614BDhqbpR5KtUYzTA+zlA7nayzJRA9ljz9CQoxthR0sDisYZLuvSMsil36t4EH/uAt8T52Xb4sVw17G+SQ== + dependencies: + csstype "^3.0.2" + "@types/semver@^7.3.12", "@types/semver@^7.5.5": version "7.5.8" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" @@ -5676,14 +5638,6 @@ argv-formatter@~1.0.0: resolved "https://registry.yarnpkg.com/argv-formatter/-/argv-formatter-1.0.0.tgz#a0ca0cbc29a5b73e836eebe1cbf6c5e0e4eb82f9" integrity sha1-oMoMvCmltz6Dbuvhy/bF4OTrgvk= -aria-query@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-4.2.2.tgz#0d2ca6c9aceb56b8977e9fed6aed7e15bbd2f83b" - integrity sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA== - dependencies: - "@babel/runtime" "^7.10.2" - "@babel/runtime-corejs3" "^7.10.2" - aria-query@~5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.1.3.tgz#19db27cd101152773631396f7a95a3b58c22c35e" @@ -7467,11 +7421,6 @@ core-js-compat@^3.8.1, core-js-compat@^3.9.0: browserslist "^4.16.3" semver "7.0.0" -core-js-pure@^3.0.0: - version "3.8.3" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.8.3.tgz#10e9e3b2592ecaede4283e8f3ad7020811587c02" - integrity sha512-V5qQZVAr9K0xu7jXg1M7qTEwuxUgqr7dUOezGaNa7i+Xn9oXAU/d1fzqD9ObuwpVQOaorO5s70ckyi1woP9lVA== - core-js-pure@^3.8.1: version "3.19.1" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.19.1.tgz#edffc1fc7634000a55ba05e95b3f0fe9587a5aa4" @@ -8094,11 +8043,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.6: - version "0.5.7" - resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.7.tgz#8c2aa6325968f2933160a0b7dbb380893ddf3e7d" - integrity sha512-ml3lJIq9YjUfM9TUnEPvEYWFSwivwIGBPKpewX7tii7fwCazA8yCioGdqQcNsItPpfFvSJ3VIdMQPj60LJhcQA== - dom-converter@^0.2: version "0.2.0" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -12702,11 +12646,6 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -lz-string@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" - integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY= - make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -14638,7 +14577,7 @@ pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" -pretty-format@^27.0.0, pretty-format@^27.0.2: +pretty-format@^27.0.0: version "27.1.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.1.0.tgz#022f3fdb19121e0a2612f3cff8d724431461b9ca" integrity sha512-4aGaud3w3rxAO6OXmK3fwBFQ0bctIOG3/if+jYEFGNGIs0EvuidQm3bZ9mlP2/t9epLNC/12czabfy7TZNSwVA== @@ -15038,14 +14977,12 @@ react-docgen@^5.0.0: node-dir "^0.1.10" strip-indent "^3.0.0" -react-dom@17.0.2: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23" - integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA== +react-dom@19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.0.0.tgz#43446f1f01c65a4cd7f7588083e686a6726cfb57" + integrity sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ== dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - scheduler "^0.20.2" + scheduler "^0.25.0" react-dom@^16.8.3: version "16.14.0" @@ -15323,13 +15260,10 @@ react-universal-interface@^0.6.2: resolved "https://registry.yarnpkg.com/react-universal-interface/-/react-universal-interface-0.6.2.tgz#5e8d438a01729a4dbbcbeeceb0b86be146fe2b3b" integrity sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw== -react@17.0.2: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" - integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" +react@19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/react/-/react-19.0.0.tgz#6e1969251b9f108870aa4bff37a0ce9ddfaaabdd" + integrity sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ== react@^16.8.3: version "16.14.0" @@ -16017,6 +15951,11 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.25.0.tgz#336cd9768e8cceebf52d3c80e3dcf5de23e7e015" + integrity sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA== + schema-utils@2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7" @@ -17788,10 +17727,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@4.1.5: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== +typescript@5.7.2: + version "5.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.2.tgz#3169cf8c4c8a828cde53ba9ecb3d2b1d5dd67be6" + integrity sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg== uglify-js@^3.1.4: version "3.12.5" From c3dd8d1b6a266d9610fd8d9822638739edc4467b Mon Sep 17 00:00:00 2001 From: Jordan Thomson Date: Wed, 18 Dec 2024 23:34:33 +1100 Subject: [PATCH 2/3] WIP --- package.json | 1 + tests/createBreakpoint.test.ts | 2 +- tests/createGlobalState.test.ts | 2 +- tests/createMemo.test.ts | 2 +- tests/createReducer.test.ts | 2 +- tests/createReducerContext.test.tsx | 2 +- tests/createStateContext.test.tsx | 2 +- tests/useAsync.test.tsx | 2 +- tests/useAsyncFn.test.tsx | 2 +- tests/useAudio.test.ts | 2 +- tests/useCookie.test.tsx | 2 +- tests/useCopyToClipboard.test.ts | 2 +- tests/useCounter.test.ts | 2 +- tests/useCustomCompareEffect.test.ts | 2 +- tests/useDebounce.test.ts | 2 +- tests/useDeepCompareEffect.test.ts | 2 +- tests/useDefault.test.ts | 2 +- tests/useEffectOnce.test.ts | 2 +- tests/useEnsuredForwardedRef.test.tsx | 2 +- tests/useError.test.ts | 2 +- tests/useEvent.test.ts | 2 +- tests/useFavicon.test.tsx | 2 +- tests/useFirstMountState.test.ts | 2 +- tests/useGetSet.test.ts | 2 +- tests/useGetSetState.test.ts | 2 +- tests/useHash.test.ts | 2 +- tests/useIntersection.test.tsx | 2 +- tests/useInterval.test.ts | 2 +- tests/useLatest.test.ts | 2 +- tests/useList.test.ts | 2 +- tests/useLocalStorage.test.ts | 2 +- tests/useLogger.test.ts | 2 +- tests/useLongPress.test.tsx | 2 +- tests/useMap.test.ts | 2 +- tests/useMeasure.test.ts | 2 +- tests/useMedia.test.ts | 2 +- tests/useMediatedState.test.ts | 2 +- tests/useMethods.test.ts | 2 +- tests/useMount.test.ts | 2 +- tests/useMountedState.test.tsx | 2 +- tests/useMultiStateValidator.test.ts | 2 +- tests/useNetworkState.test.ts | 2 +- tests/useObservable.test.ts | 2 +- tests/useOrientation.test.ts | 2 +- tests/usePrevious.test.ts | 2 +- tests/usePreviousDistinct.test.tsx | 2 +- tests/useQueue.test.ts | 2 +- tests/useRaf.test.ts | 2 +- tests/useRafLoop.test.tsx | 2 +- tests/useRafState.test.ts | 2 +- tests/useRendersCount.test.ts | 2 +- tests/useScrollbarWidth.test.ts | 2 +- tests/useSearchParam.test.ts | 2 +- tests/useSet.test.ts | 2 +- tests/useSetState.test.ts | 2 +- tests/useShallowCompareEffect.test.ts | 2 +- tests/useSpring.test.ts | 2 +- tests/useStateList.test.ts | 2 +- tests/useStateValidator.test.ts | 2 +- tests/useStateWithHistory.test.ts | 2 +- tests/useThrottle.test.ts | 2 +- tests/useThrottleFn.test.ts | 2 +- tests/useTimeout.test.ts | 2 +- tests/useTimeoutFn.test.ts | 2 +- tests/useTitle.test.ts | 2 +- tests/useToggle.test.ts | 2 +- tests/useTween.test.ts | 2 +- tests/useUnmount.test.ts | 2 +- tests/useUnmountPromise.test.ts | 2 +- tests/useUpdate.test.ts | 2 +- tests/useUpdateEffect.test.ts | 2 +- tests/useUpsert.test.ts | 2 +- tests/useWindowScroll.test.tsx | 2 +- tests/useWindowSize.test.tsx | 2 +- yarn.lock | 43 ++++++++++++++++++++++++++- 75 files changed, 116 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index f3f10a3786..b623d2ae0d 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "@storybook/addon-notes": "5.3.21", "@storybook/addon-options": "5.3.21", "@storybook/react": "6.4.9", + "@testing-library/dom": "10.4.0", "@testing-library/react": "16.1.0", "@testing-library/react-hooks": "8.0.1", "@types/jest": "27.5.2", diff --git a/tests/createBreakpoint.test.ts b/tests/createBreakpoint.test.ts index d3e0258ad9..575a3b6b8a 100644 --- a/tests/createBreakpoint.test.ts +++ b/tests/createBreakpoint.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import createBreakpoint from '../src/factory/createBreakpoint'; const useBreakpointA = createBreakpoint(); diff --git a/tests/createGlobalState.test.ts b/tests/createGlobalState.test.ts index 6c1945cd77..e153f3be29 100644 --- a/tests/createGlobalState.test.ts +++ b/tests/createGlobalState.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import createGlobalState from '../src/factory/createGlobalState'; describe('useGlobalState', () => { diff --git a/tests/createMemo.test.ts b/tests/createMemo.test.ts index 0cf4e0d130..fe2420fef3 100644 --- a/tests/createMemo.test.ts +++ b/tests/createMemo.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import createMemo from '../src/factory/createMemo'; const getDouble = jest.fn((n: number): number => n * 2); diff --git a/tests/createReducer.test.ts b/tests/createReducer.test.ts index 5fcc35fe28..a952b6a1a8 100644 --- a/tests/createReducer.test.ts +++ b/tests/createReducer.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import logger from 'redux-logger'; import thunk from 'redux-thunk'; import createReducer from '../src/factory/createReducer'; diff --git a/tests/createReducerContext.test.tsx b/tests/createReducerContext.test.tsx index 54d69a39d2..39baa1c869 100644 --- a/tests/createReducerContext.test.tsx +++ b/tests/createReducerContext.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { render, fireEvent } from '@testing-library/react'; -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import createReducerContext from '../src/factory/createReducerContext'; type Action = 'increment' | 'decrement'; diff --git a/tests/createStateContext.test.tsx b/tests/createStateContext.test.tsx index c5c861f808..15039d50a0 100644 --- a/tests/createStateContext.test.tsx +++ b/tests/createStateContext.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { render, fireEvent } from '@testing-library/react'; -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import createStateContext from '../src/factory/createStateContext'; it('should create a hook and a provider', () => { diff --git a/tests/useAsync.test.tsx b/tests/useAsync.test.tsx index e9c54cd45e..ed2517cb05 100644 --- a/tests/useAsync.test.tsx +++ b/tests/useAsync.test.tsx @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useCallback } from 'react'; import useAsync from '../src/useAsync'; diff --git a/tests/useAsyncFn.test.tsx b/tests/useAsyncFn.test.tsx index 9a1d992205..cd36d68490 100644 --- a/tests/useAsyncFn.test.tsx +++ b/tests/useAsyncFn.test.tsx @@ -5,7 +5,7 @@ // does not automatically invoke the function // and it can take arguments. -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useAsyncFn, { AsyncState } from '../src/useAsyncFn'; type AdderFn = (a?: number, b?: number) => Promise; diff --git a/tests/useAudio.test.ts b/tests/useAudio.test.ts index fac5df4794..2200460702 100644 --- a/tests/useAudio.test.ts +++ b/tests/useAudio.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useAudio from '../src/useAudio'; const setUp = ( src: string = 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3', diff --git a/tests/useCookie.test.tsx b/tests/useCookie.test.tsx index cc72dc460a..3bea59df68 100644 --- a/tests/useCookie.test.tsx +++ b/tests/useCookie.test.tsx @@ -1,4 +1,4 @@ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import Cookies from 'js-cookie'; import { useCookie } from '../src'; diff --git a/tests/useCopyToClipboard.test.ts b/tests/useCopyToClipboard.test.ts index f7ddae136c..f0a74a4b99 100644 --- a/tests/useCopyToClipboard.test.ts +++ b/tests/useCopyToClipboard.test.ts @@ -1,5 +1,5 @@ import writeText from 'copy-to-clipboard'; -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { useCopyToClipboard } from '../src'; const valueToRaiseMockException = 'fake input causing exception in copy to clipboard'; diff --git a/tests/useCounter.test.ts b/tests/useCounter.test.ts index 8cfbbc410e..d4e8d5d5af 100644 --- a/tests/useCounter.test.ts +++ b/tests/useCounter.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useCounter from '../src/useCounter'; const setUp = (initialValue?: number, max: number | null = null, min: number | null = null) => diff --git a/tests/useCustomCompareEffect.test.ts b/tests/useCustomCompareEffect.test.ts index 2ca4dd55c3..8b11b8f48f 100644 --- a/tests/useCustomCompareEffect.test.ts +++ b/tests/useCustomCompareEffect.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useCustomCompareEffect } from '../src'; import { useEffect } from 'react'; import isDeepEqual from '../src/misc/isDeepEqual'; diff --git a/tests/useDebounce.test.ts b/tests/useDebounce.test.ts index 2f34d21f20..74bea9796b 100644 --- a/tests/useDebounce.test.ts +++ b/tests/useDebounce.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { DependencyList } from 'react'; import { UseDebounceReturn } from '../src/useDebounce'; import { useDebounce } from '../src'; diff --git a/tests/useDeepCompareEffect.test.ts b/tests/useDeepCompareEffect.test.ts index d76897772a..0453f706c9 100644 --- a/tests/useDeepCompareEffect.test.ts +++ b/tests/useDeepCompareEffect.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useDeepCompareEffect } from '../src'; import { useEffect } from 'react'; diff --git a/tests/useDefault.test.ts b/tests/useDefault.test.ts index a60537080f..25e17bad5a 100644 --- a/tests/useDefault.test.ts +++ b/tests/useDefault.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useDefault from '../src/useDefault'; const setUp = (defaultValue: any, initialValue: any) => diff --git a/tests/useEffectOnce.test.ts b/tests/useEffectOnce.test.ts index a94345ef2e..c4795039a5 100644 --- a/tests/useEffectOnce.test.ts +++ b/tests/useEffectOnce.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useEffectOnce } from '../src'; const mockEffectCleanup = jest.fn(); diff --git a/tests/useEnsuredForwardedRef.test.tsx b/tests/useEnsuredForwardedRef.test.tsx index d6ba4fe63c..60318f165e 100644 --- a/tests/useEnsuredForwardedRef.test.tsx +++ b/tests/useEnsuredForwardedRef.test.tsx @@ -1,6 +1,6 @@ import React, { useRef } from 'react'; import ReactDOM from 'react-dom'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import TestUtils from 'react-dom/test-utils'; import { ensuredForwardRef, useEnsuredForwardedRef } from '../src'; diff --git a/tests/useError.test.ts b/tests/useError.test.ts index 2e3af244dd..90fbfa69d3 100644 --- a/tests/useError.test.ts +++ b/tests/useError.test.ts @@ -1,4 +1,4 @@ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useError } from '../src'; const setup = () => renderHook(() => useError()); diff --git a/tests/useEvent.test.ts b/tests/useEvent.test.ts index ac725d64a5..ee45eea57b 100644 --- a/tests/useEvent.test.ts +++ b/tests/useEvent.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useEvent, { ListenerType1, ListenerType2 } from '../src/useEvent'; interface Props { diff --git a/tests/useFavicon.test.tsx b/tests/useFavicon.test.tsx index 495881a0a9..05c58381f3 100644 --- a/tests/useFavicon.test.tsx +++ b/tests/useFavicon.test.tsx @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useFavicon from '../src/useFavicon'; afterEach(() => { diff --git a/tests/useFirstMountState.test.ts b/tests/useFirstMountState.test.ts index c6a677a973..df77beb883 100644 --- a/tests/useFirstMountState.test.ts +++ b/tests/useFirstMountState.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useFirstMountState } from '../src'; describe('useFirstMountState', () => { diff --git a/tests/useGetSet.test.ts b/tests/useGetSet.test.ts index 9ef16402fd..02e8839cec 100644 --- a/tests/useGetSet.test.ts +++ b/tests/useGetSet.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useGetSet from '../src/useGetSet'; const setUp = (initialValue: any) => renderHook(() => useGetSet(initialValue)); diff --git a/tests/useGetSetState.test.ts b/tests/useGetSetState.test.ts index 54c2fb198f..32433a6254 100644 --- a/tests/useGetSetState.test.ts +++ b/tests/useGetSetState.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useGetSetState from '../src/useGetSetState'; const originalConsoleError = console.error; diff --git a/tests/useHash.test.ts b/tests/useHash.test.ts index da2f76e689..2cc54b6bdb 100644 --- a/tests/useHash.test.ts +++ b/tests/useHash.test.ts @@ -1,4 +1,4 @@ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useHash } from '../src/useHash'; (global as any).window = Object.create(window); diff --git a/tests/useIntersection.test.tsx b/tests/useIntersection.test.tsx index 0d0cf29b19..948acc6e71 100644 --- a/tests/useIntersection.test.tsx +++ b/tests/useIntersection.test.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'; import TestUtils from 'react-dom/test-utils'; import TestRenderer from 'react-test-renderer'; import { intersectionObserver } from '@shopify/jest-dom-mocks'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useIntersection } from '../src'; beforeEach(() => { diff --git a/tests/useInterval.test.ts b/tests/useInterval.test.ts index f1ba672f5a..ddedf08edf 100644 --- a/tests/useInterval.test.ts +++ b/tests/useInterval.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useInterval } from '../src'; let callback; diff --git a/tests/useLatest.test.ts b/tests/useLatest.test.ts index 7bd1e0f9a4..dce34ee07f 100644 --- a/tests/useLatest.test.ts +++ b/tests/useLatest.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useLatest from '../src/useLatest'; const setUp = () => renderHook(({ state }) => useLatest(state), { initialProps: { state: 0 } }); diff --git a/tests/useList.test.ts b/tests/useList.test.ts index e53a9e0341..469efbc524 100644 --- a/tests/useList.test.ts +++ b/tests/useList.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { useRef } from 'react'; import useList, { ListActions } from '../src/useList'; diff --git a/tests/useLocalStorage.test.ts b/tests/useLocalStorage.test.ts index 1ec54dd637..b7a7e7bf5c 100644 --- a/tests/useLocalStorage.test.ts +++ b/tests/useLocalStorage.test.ts @@ -1,6 +1,6 @@ import useLocalStorage from '../src/useLocalStorage'; import 'jest-localstorage-mock'; -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; describe(useLocalStorage, () => { afterEach(() => { diff --git a/tests/useLogger.test.ts b/tests/useLogger.test.ts index 3ebad708c2..a997694117 100644 --- a/tests/useLogger.test.ts +++ b/tests/useLogger.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useLogger from '../src/useLogger'; const logSpy = jest.spyOn(global.console, 'log').mockImplementation(() => {}); diff --git a/tests/useLongPress.test.tsx b/tests/useLongPress.test.tsx index 652e2e7a69..3d71c6b02a 100644 --- a/tests/useLongPress.test.tsx +++ b/tests/useLongPress.test.tsx @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useLongPress from '../src/useLongPress'; const callback = jest.fn(); diff --git a/tests/useMap.test.ts b/tests/useMap.test.ts index 5267cf64fd..1f16458722 100644 --- a/tests/useMap.test.ts +++ b/tests/useMap.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useMap from '../src/useMap'; const setUp = (initialMap?: T) => renderHook(() => useMap(initialMap)); diff --git a/tests/useMeasure.test.ts b/tests/useMeasure.test.ts index c32fdaeee7..fe99254f05 100644 --- a/tests/useMeasure.test.ts +++ b/tests/useMeasure.test.ts @@ -1,4 +1,4 @@ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import useMeasure, { UseMeasureRef } from '../src/useMeasure'; it('by default, state defaults every value to -1', () => { diff --git a/tests/useMedia.test.ts b/tests/useMedia.test.ts index ab0467a6c6..d51bdebe44 100644 --- a/tests/useMedia.test.ts +++ b/tests/useMedia.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { renderHook as renderHookSSR } from '@testing-library/react-hooks/server'; import { useMedia } from '../src'; diff --git a/tests/useMediatedState.test.ts b/tests/useMediatedState.test.ts index cdb3588d50..4acb5cccdc 100644 --- a/tests/useMediatedState.test.ts +++ b/tests/useMediatedState.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { Dispatch, SetStateAction } from 'react'; import { useMediatedState } from '../src'; import { StateMediator, UseMediatedStateReturn } from '../src/useMediatedState'; diff --git a/tests/useMethods.test.ts b/tests/useMethods.test.ts index 43c1011fa2..265447a5db 100644 --- a/tests/useMethods.test.ts +++ b/tests/useMethods.test.ts @@ -1,4 +1,4 @@ -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react'; import { useMethods } from '../src'; it('should have initialState value as the returned state value', () => { diff --git a/tests/useMount.test.ts b/tests/useMount.test.ts index bb1dc8e104..e59e2aebd9 100644 --- a/tests/useMount.test.ts +++ b/tests/useMount.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useMount } from '../src'; const mockCallback = jest.fn(); diff --git a/tests/useMountedState.test.tsx b/tests/useMountedState.test.tsx index d6f51cec30..bbcc80ef94 100644 --- a/tests/useMountedState.test.tsx +++ b/tests/useMountedState.test.tsx @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useMountedState from '../src/useMountedState'; describe('useMountedState', () => { diff --git a/tests/useMultiStateValidator.test.ts b/tests/useMultiStateValidator.test.ts index e98492de6d..ebdacfaa3c 100644 --- a/tests/useMultiStateValidator.test.ts +++ b/tests/useMultiStateValidator.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { useState } from 'react'; import { MultiStateValidator, useMultiStateValidator } from '../src/useMultiStateValidator'; import { UseStateValidatorReturn, ValidityState } from '../src/useStateValidator'; diff --git a/tests/useNetworkState.test.ts b/tests/useNetworkState.test.ts index 93c583aac0..1b419a34fe 100644 --- a/tests/useNetworkState.test.ts +++ b/tests/useNetworkState.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useNetworkState } from '../src'; //ToDo: improve tests diff --git a/tests/useObservable.test.ts b/tests/useObservable.test.ts index 2e1240e7e9..968e95635e 100644 --- a/tests/useObservable.test.ts +++ b/tests/useObservable.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { Subject } from 'rxjs'; import * as useIsomorphicLayoutEffect from '../src/useIsomorphicLayoutEffect'; import useObservable, { Observable } from '../src/useObservable'; diff --git a/tests/useOrientation.test.ts b/tests/useOrientation.test.ts index df45546263..6ec6c6da17 100644 --- a/tests/useOrientation.test.ts +++ b/tests/useOrientation.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { replaceRaf } from 'raf-stub'; import useOrientation from '../src/useOrientation'; diff --git a/tests/usePrevious.test.ts b/tests/usePrevious.test.ts index 3f75d1f472..e60bfb60fe 100644 --- a/tests/usePrevious.test.ts +++ b/tests/usePrevious.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import usePrevious from '../src/usePrevious'; const setUp = () => renderHook(({ state }) => usePrevious(state), { initialProps: { state: 0 } }); diff --git a/tests/usePreviousDistinct.test.tsx b/tests/usePreviousDistinct.test.tsx index 67931bb3f5..75fc9b35c3 100644 --- a/tests/usePreviousDistinct.test.tsx +++ b/tests/usePreviousDistinct.test.tsx @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import usePreviousDistinct, { Predicate } from '../src/usePreviousDistinct'; describe('usePreviousDistinct', () => { diff --git a/tests/useQueue.test.ts b/tests/useQueue.test.ts index dce662d500..ff7f38727c 100644 --- a/tests/useQueue.test.ts +++ b/tests/useQueue.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useQueue from '../src/useQueue'; const setUp = (initialQueue?: any[]) => renderHook(() => useQueue(initialQueue)); diff --git a/tests/useRaf.test.ts b/tests/useRaf.test.ts index 52f86b18df..eb35cd4c39 100644 --- a/tests/useRaf.test.ts +++ b/tests/useRaf.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { replaceRaf } from 'raf-stub'; import useRaf from '../src/useRaf'; diff --git a/tests/useRafLoop.test.tsx b/tests/useRafLoop.test.tsx index 3830f88ac3..1c0fcf4554 100644 --- a/tests/useRafLoop.test.tsx +++ b/tests/useRafLoop.test.tsx @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { replaceRaf } from 'raf-stub'; import useRafLoop from '../src/useRafLoop'; diff --git a/tests/useRafState.test.ts b/tests/useRafState.test.ts index f1e8db48fe..2d6b0436dd 100644 --- a/tests/useRafState.test.ts +++ b/tests/useRafState.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { replaceRaf } from 'raf-stub'; import useRafState from '../src/useRafState'; diff --git a/tests/useRendersCount.test.ts b/tests/useRendersCount.test.ts index a18122a0c5..3b10444506 100644 --- a/tests/useRendersCount.test.ts +++ b/tests/useRendersCount.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useRendersCount } from '../src'; describe('useRendersCount', () => { diff --git a/tests/useScrollbarWidth.test.ts b/tests/useScrollbarWidth.test.ts index 26a60aa423..a81e21dabb 100644 --- a/tests/useScrollbarWidth.test.ts +++ b/tests/useScrollbarWidth.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { scrollbarWidth } from '@xobotyi/scrollbar-width'; import { useScrollbarWidth } from '../src'; import { replaceRaf } from 'raf-stub'; diff --git a/tests/useSearchParam.test.ts b/tests/useSearchParam.test.ts index d3be101631..d2d43e6274 100644 --- a/tests/useSearchParam.test.ts +++ b/tests/useSearchParam.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useSearchParam from '../src/useSearchParam'; const { location } = window; diff --git a/tests/useSet.test.ts b/tests/useSet.test.ts index b4daa70d3e..30f558aadf 100644 --- a/tests/useSet.test.ts +++ b/tests/useSet.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useSet from '../src/useSet'; const setUp = (initialSet?: Set) => renderHook(() => useSet(initialSet)); diff --git a/tests/useSetState.test.ts b/tests/useSetState.test.ts index 3e6df86633..c7f27bd130 100644 --- a/tests/useSetState.test.ts +++ b/tests/useSetState.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useSetState from '../src/useSetState'; const setUp = (initialState?: object) => renderHook(() => useSetState(initialState)); diff --git a/tests/useShallowCompareEffect.test.ts b/tests/useShallowCompareEffect.test.ts index 2079de48b9..33c54a186b 100644 --- a/tests/useShallowCompareEffect.test.ts +++ b/tests/useShallowCompareEffect.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useShallowCompareEffect } from '../src'; import { useEffect } from 'react'; diff --git a/tests/useSpring.test.ts b/tests/useSpring.test.ts index 75c99a4e21..e5d39c093e 100644 --- a/tests/useSpring.test.ts +++ b/tests/useSpring.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { Spring } from 'rebound'; import useSpring from '../src/useSpring'; diff --git a/tests/useStateList.test.ts b/tests/useStateList.test.ts index 21e5641036..cd54c0545a 100644 --- a/tests/useStateList.test.ts +++ b/tests/useStateList.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useStateList from '../src/useStateList'; describe('useStateList', () => { diff --git a/tests/useStateValidator.test.ts b/tests/useStateValidator.test.ts index ff3b09c818..469d94f220 100644 --- a/tests/useStateValidator.test.ts +++ b/tests/useStateValidator.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { useState } from 'react'; import useStateValidator, { StateValidator, diff --git a/tests/useStateWithHistory.test.ts b/tests/useStateWithHistory.test.ts index 5261daa8dc..fda573f890 100644 --- a/tests/useStateWithHistory.test.ts +++ b/tests/useStateWithHistory.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { useRef } from 'react'; import { UseStateHistoryReturn, useStateWithHistory } from '../src/useStateWithHistory'; import { IHookStateSetAction } from '../src/misc/hookState'; diff --git a/tests/useThrottle.test.ts b/tests/useThrottle.test.ts index 6b4128a0d9..d112d53cac 100644 --- a/tests/useThrottle.test.ts +++ b/tests/useThrottle.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useThrottle from '../src/useThrottle'; describe('useThrottle', () => { diff --git a/tests/useThrottleFn.test.ts b/tests/useThrottleFn.test.ts index 1b5b92bcdb..288f9a5f77 100644 --- a/tests/useThrottleFn.test.ts +++ b/tests/useThrottleFn.test.ts @@ -1,4 +1,4 @@ -import { renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { renderHook, RenderHookResult } from '@testing-library/react'; import { useThrottleFn } from '../src'; describe('useThrottleFn', () => { diff --git a/tests/useTimeout.test.ts b/tests/useTimeout.test.ts index e654d97a2d..dc14ef5732 100644 --- a/tests/useTimeout.test.ts +++ b/tests/useTimeout.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { useTimeout } from '../src'; import { UseTimeoutReturn } from '../src/useTimeout'; diff --git a/tests/useTimeoutFn.test.ts b/tests/useTimeoutFn.test.ts index d5fe51f45a..d303e28add 100644 --- a/tests/useTimeoutFn.test.ts +++ b/tests/useTimeoutFn.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { act, renderHook, RenderHookResult } from '@testing-library/react'; import { useTimeoutFn } from '../src'; import { UseTimeoutFnReturn } from '../src/useTimeoutFn'; diff --git a/tests/useTitle.test.ts b/tests/useTitle.test.ts index 30cd3d89d5..936b079b62 100644 --- a/tests/useTitle.test.ts +++ b/tests/useTitle.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useTitle from '../src/useTitle'; describe('useTitle', () => { diff --git a/tests/useToggle.test.ts b/tests/useToggle.test.ts index ea89f5aa22..5e7230e711 100644 --- a/tests/useToggle.test.ts +++ b/tests/useToggle.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useToggle from '../src/useToggle'; const setUp = (initialValue: boolean) => renderHook(() => useToggle(initialValue)); diff --git a/tests/useTween.test.ts b/tests/useTween.test.ts index ee8a5f42ae..dc1cb07d84 100644 --- a/tests/useTween.test.ts +++ b/tests/useTween.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { easing } from 'ts-easing'; import * as useRaf from '../src/useRaf'; import useTween from '../src/useTween'; diff --git a/tests/useUnmount.test.ts b/tests/useUnmount.test.ts index 2ef1b410ab..e6da79dc11 100644 --- a/tests/useUnmount.test.ts +++ b/tests/useUnmount.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useUnmount } from '../src'; describe('useUnmount', () => { diff --git a/tests/useUnmountPromise.test.ts b/tests/useUnmountPromise.test.ts index fefbf1c48e..9ac6bdbc4f 100644 --- a/tests/useUnmountPromise.test.ts +++ b/tests/useUnmountPromise.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import useUnmountPromise from '../src/useUnmountPromise'; describe('useUnmountPromise', () => { diff --git a/tests/useUpdate.test.ts b/tests/useUpdate.test.ts index 0f88338456..2d3b6eef50 100644 --- a/tests/useUpdate.test.ts +++ b/tests/useUpdate.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useUpdate from '../src/useUpdate'; describe('useUpdate', () => { diff --git a/tests/useUpdateEffect.test.ts b/tests/useUpdateEffect.test.ts index 02c81461de..0b816184a3 100644 --- a/tests/useUpdateEffect.test.ts +++ b/tests/useUpdateEffect.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react'; import { useUpdateEffect } from '../src'; it('should run effect on update', () => { diff --git a/tests/useUpsert.test.ts b/tests/useUpsert.test.ts index 7dfa676fff..8173911fd7 100644 --- a/tests/useUpsert.test.ts +++ b/tests/useUpsert.test.ts @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import useUpsert from '../src/useUpsert'; interface TestItem { diff --git a/tests/useWindowScroll.test.tsx b/tests/useWindowScroll.test.tsx index e29a8d2b92..c833039c93 100644 --- a/tests/useWindowScroll.test.tsx +++ b/tests/useWindowScroll.test.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; import { render, act as reactAct } from '@testing-library/react'; -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { replaceRaf } from 'raf-stub'; import useWindowScroll from '../src/useWindowScroll'; diff --git a/tests/useWindowSize.test.tsx b/tests/useWindowSize.test.tsx index da5646f165..30d6cb5a62 100644 --- a/tests/useWindowSize.test.tsx +++ b/tests/useWindowSize.test.tsx @@ -1,4 +1,4 @@ -import { act, renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react'; import { replaceRaf } from 'raf-stub'; import useWindowSize from '../src/useWindowSize'; import { isBrowser } from '../src/misc/util'; diff --git a/yarn.lock b/yarn.lock index 55bde4d17a..3946ad7005 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4675,6 +4675,20 @@ resolve-from "^5.0.0" store2 "^2.12.0" +"@testing-library/dom@10.4.0": + version "10.4.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8" + integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/runtime" "^7.12.5" + "@types/aria-query" "^5.0.1" + 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" + "@testing-library/react-hooks@8.0.1": version "8.0.1" resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-8.0.1.tgz#0924bbd5b55e0c0c0502d1754657ada66947ca12" @@ -4728,6 +4742,11 @@ resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== +"@types/aria-query@^5.0.1": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708" + integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw== + "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.12" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.12.tgz#4d8e9e51eb265552a7e4f1ff2219ab6133bdfb2d" @@ -5638,6 +5657,13 @@ argv-formatter@~1.0.0: resolved "https://registry.yarnpkg.com/argv-formatter/-/argv-formatter-1.0.0.tgz#a0ca0cbc29a5b73e836eebe1cbf6c5e0e4eb82f9" integrity sha1-oMoMvCmltz6Dbuvhy/bF4OTrgvk= +aria-query@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e" + integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A== + dependencies: + dequal "^2.0.3" + aria-query@~5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.1.3.tgz#19db27cd101152773631396f7a95a3b58c22c35e" @@ -7933,6 +7959,11 @@ depd@~1.1.2: resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= +dequal@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + des.js@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" @@ -8043,6 +8074,11 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +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== + dom-converter@^0.2: version "0.2.0" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -12646,6 +12682,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lz-string@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" + integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ== + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -14587,7 +14628,7 @@ pretty-format@^27.0.0: ansi-styles "^5.0.0" react-is "^17.0.1" -pretty-format@^27.5.1: +pretty-format@^27.0.2, pretty-format@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== From a7a9a151d2423e0ec7d18b74eb596f02235007dd Mon Sep 17 00:00:00 2001 From: Jordan Thomson Date: Wed, 18 Dec 2024 23:50:02 +1100 Subject: [PATCH 3/3] some more types --- package.json | 2 +- src/useLongPress.ts | 4 ++-- src/useMethods.ts | 2 +- src/useMouse.ts | 2 +- src/useMouseWheel.ts | 2 +- src/usePrevious.ts | 2 +- src/usePreviousDistinct.ts | 2 +- src/useThrottle.ts | 2 +- src/useThrottleFn.ts | 4 ++-- src/useTimeoutFn.ts | 2 +- src/useToggle.ts | 8 ++++---- yarn.lock | 5 +++++ 12 files changed, 21 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index b623d2ae0d..1bd644b8ce 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "set-harmonic-interval": "^1.0.1", "throttle-debounce": "^3.0.1", "ts-easing": "^0.2.0", - "tslib": "^2.1.0" + "tslib": "^2.8.1" }, "peerDependencies": { "react": "*", diff --git a/src/useLongPress.ts b/src/useLongPress.ts index a885e091f5..1bb99eb924 100644 --- a/src/useLongPress.ts +++ b/src/useLongPress.ts @@ -22,8 +22,8 @@ const useLongPress = ( callback: (e: TouchEvent | MouseEvent) => void, { isPreventDefault = true, delay = 300 }: Options = {} ) => { - const timeout = useRef>(); - const target = useRef(); + const timeout = useRef>(undefined); + const target = useRef(undefined); const start = useCallback( (event: TouchEvent | MouseEvent) => { diff --git a/src/useMethods.ts b/src/useMethods.ts index db3cacb618..56d4bf9b9b 100644 --- a/src/useMethods.ts +++ b/src/useMethods.ts @@ -24,7 +24,7 @@ const useMethods = ( [createMethods] ); - const [state, dispatch] = useReducer>(reducer, initialState); + const [state, dispatch] = useReducer(reducer, initialState); const wrappedMethods: WrappedMethods = useMemo(() => { const actionTypes = Object.keys(createMethods(initialState)); diff --git a/src/useMouse.ts b/src/useMouse.ts index cbebbba4ef..2cc0517b1d 100644 --- a/src/useMouse.ts +++ b/src/useMouse.ts @@ -14,7 +14,7 @@ export interface State { elW: number; } -const useMouse = (ref: RefObject): State => { +const useMouse = (ref: RefObject): State => { if (process.env.NODE_ENV === 'development') { if (typeof ref !== 'object' || typeof ref.current === 'undefined') { console.error('useMouse expects a single ref argument.'); diff --git a/src/useMouseWheel.ts b/src/useMouseWheel.ts index 31638f392f..32e830191f 100644 --- a/src/useMouseWheel.ts +++ b/src/useMouseWheel.ts @@ -4,7 +4,7 @@ import { off, on } from './misc/util'; export default () => { const [mouseWheelScrolled, setMouseWheelScrolled] = useState(0); useEffect(() => { - const updateScroll = (e: MouseWheelEvent) => { + const updateScroll = (e: WheelEvent) => { setMouseWheelScrolled(e.deltaY + mouseWheelScrolled); }; on(window, 'wheel', updateScroll, false); diff --git a/src/usePrevious.ts b/src/usePrevious.ts index a5233144ca..e0be56c778 100644 --- a/src/usePrevious.ts +++ b/src/usePrevious.ts @@ -1,7 +1,7 @@ import { useEffect, useRef } from 'react'; export default function usePrevious(state: T): T | undefined { - const ref = useRef(); + const ref = useRef(undefined); useEffect(() => { ref.current = state; diff --git a/src/usePreviousDistinct.ts b/src/usePreviousDistinct.ts index 10bf5f8293..551a16b1bf 100644 --- a/src/usePreviousDistinct.ts +++ b/src/usePreviousDistinct.ts @@ -9,7 +9,7 @@ export default function usePreviousDistinct( value: T, compare: Predicate = strictEquals ): T | undefined { - const prevRef = useRef(); + const prevRef = useRef(undefined); const curRef = useRef(value); const isFirstMount = useFirstMountState(); diff --git a/src/useThrottle.ts b/src/useThrottle.ts index b231ba626d..b3ebcd4819 100644 --- a/src/useThrottle.ts +++ b/src/useThrottle.ts @@ -3,7 +3,7 @@ import useUnmount from './useUnmount'; const useThrottle = (value: T, ms: number = 200) => { const [state, setState] = useState(value); - const timeout = useRef>(); + const timeout = useRef>(undefined); const nextValue = useRef(null) as any; const hasNextValue = useRef(0) as any; diff --git a/src/useThrottleFn.ts b/src/useThrottleFn.ts index 7b197a1f41..eaf8cd3e24 100644 --- a/src/useThrottleFn.ts +++ b/src/useThrottleFn.ts @@ -3,8 +3,8 @@ import useUnmount from './useUnmount'; const useThrottleFn = (fn: (...args: U) => T, ms: number = 200, args: U) => { const [state, setState] = useState(null); - const timeout = useRef>(); - const nextArgs = useRef(); + const timeout = useRef>(undefined); + const nextArgs = useRef(undefined); useEffect(() => { if (!timeout.current) { diff --git a/src/useTimeoutFn.ts b/src/useTimeoutFn.ts index 4f9e8c50d5..9b9abadece 100644 --- a/src/useTimeoutFn.ts +++ b/src/useTimeoutFn.ts @@ -4,7 +4,7 @@ export type UseTimeoutFnReturn = [() => boolean | null, () => void, () => void]; export default function useTimeoutFn(fn: Function, ms: number = 0): UseTimeoutFnReturn { const ready = useRef(false); - const timeout = useRef>(); + const timeout = useRef>(undefined); const callback = useRef(fn); const isReady = useCallback(() => ready.current, []); diff --git a/src/useToggle.ts b/src/useToggle.ts index 8e380e19e2..06ac01574b 100644 --- a/src/useToggle.ts +++ b/src/useToggle.ts @@ -1,10 +1,10 @@ -import { Reducer, useReducer } from 'react'; +import { useReducer, ActionDispatch } from 'react'; -const toggleReducer = (state: boolean, nextValue?: any) => +const toggleReducer = (state: any, nextValue?: any) => typeof nextValue === 'boolean' ? nextValue : !state; -const useToggle = (initialValue: boolean): [boolean, (nextValue?: any) => void] => { - return useReducer>(toggleReducer, initialValue); +const useToggle = (initialValue: boolean): [boolean, ActionDispatch] => { + return useReducer(toggleReducer, initialValue); }; export default useToggle; diff --git a/yarn.lock b/yarn.lock index 3946ad7005..ab2cd44045 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17612,6 +17612,11 @@ tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== +tslib@^2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"