From 35c482ac9211213bd46b66219e2119eb1e4a324f Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Fri, 19 Nov 2021 03:59:55 -0800 Subject: [PATCH] Fix emotion cache output garbage in unit tests Summary: emotion/cache started generating nonsense warnings about SSR again when running unit tests. This is because atm emotion/cache is 3(!) times in our dep tree, and the wrong one got patched. Tried to dedupe that, but it seems inevitable: - emotion/react requires v. 11.6.0 of it - emotion/css requires v. 11.5.0 because a newer version of that package hasn't been released - console-feed still uses emotion 10. So instead, just added an other patch Reviewed By: passy Differential Revision: D32557413 fbshipit-source-id: 8a61a8065d21123453b3345b25ff87a9865094ed --- desktop/flipper-ui-core/package.json | 4 ++-- ...@emotion+react++@emotion+cache+11.6.0.patch | 18 ++++++++++++++++++ desktop/yarn.lock | 4 ++-- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 desktop/patches/@emotion+react++@emotion+cache+11.6.0.patch diff --git a/desktop/flipper-ui-core/package.json b/desktop/flipper-ui-core/package.json index e833fc27b..869541039 100644 --- a/desktop/flipper-ui-core/package.json +++ b/desktop/flipper-ui-core/package.json @@ -12,8 +12,8 @@ "dependencies": { "@ant-design/icons": "^4.7.0", "@emotion/css": "^11.5.0", - "@emotion/react": "^11.5.0", - "@emotion/styled": "^11.3.0", + "@emotion/react": "^11.6.0", + "@emotion/styled": "^11.6.0", "@iarna/toml": "^2.2.5", "@tanishiking/aho-corasick": "^0.0.1", "@types/archiver": "^5.1.1", diff --git a/desktop/patches/@emotion+react++@emotion+cache+11.6.0.patch b/desktop/patches/@emotion+react++@emotion+cache+11.6.0.patch new file mode 100644 index 000000000..024326fc8 --- /dev/null +++ b/desktop/patches/@emotion+react++@emotion+cache+11.6.0.patch @@ -0,0 +1,18 @@ +diff --git a/node_modules/@emotion/react/node_modules/@emotion/cache/dist/emotion-cache.cjs.dev.js b/node_modules/@emotion/react/node_modules/@emotion/cache/dist/emotion-cache.cjs.dev.js +index b1ad6ac..e577f28 100644 +--- a/node_modules/@emotion/react/node_modules/@emotion/cache/dist/emotion-cache.cjs.dev.js ++++ b/node_modules/@emotion/react/node_modules/@emotion/cache/dist/emotion-cache.cjs.dev.js +@@ -158,9 +158,10 @@ var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { + return; + } + +- unsafePseudoClasses.forEach(function (unsafePseudoClass) { +- console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); +- }); ++ // messes up unit tests, and we don't do SSR! ++ // unsafePseudoClasses.forEach(function (unsafePseudoClass) { ++ // console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); ++ // }); + } + }; + }; diff --git a/desktop/yarn.lock b/desktop/yarn.lock index 469c43a2f..0f1267c17 100644 --- a/desktop/yarn.lock +++ b/desktop/yarn.lock @@ -1667,7 +1667,7 @@ resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.5.tgz#2c40f81449a4e554e9fc6396910ed4843ec2be50" integrity sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ== -"@emotion/react@^11.5.0", "@emotion/react@^11.6.0": +"@emotion/react@^11.6.0": version "11.6.0" resolved "https://registry.yarnpkg.com/@emotion/react/-/react-11.6.0.tgz#61fcb95c1e01255734c2c721cb9beabcf521eb0f" integrity sha512-23MnRZFBN9+D1lHXC5pD6z4X9yhPxxtHr6f+iTGz6Fv6Rda0GdefPrsHL7otsEf+//7uqCdT5QtHeRxHCERzuw== @@ -1735,7 +1735,7 @@ "@emotion/styled-base" "^10.0.27" babel-plugin-emotion "^10.0.27" -"@emotion/styled@^11.3.0": +"@emotion/styled@^11.6.0": version "11.6.0" resolved "https://registry.yarnpkg.com/@emotion/styled/-/styled-11.6.0.tgz#9230d1a7bcb2ebf83c6a579f4c80e0664132d81d" integrity sha512-mxVtVyIOTmCAkFbwIp+nCjTXJNgcz4VWkOYQro87jE2QBTydnkiYusMrRGFtzuruiGK4dDaNORk4gH049iiQuw==