diff --git a/desktop/flipper-ui/src/Client.tsx b/desktop/flipper-ui/src/Client.tsx index 0dd22f3d920..2ed77eff60f 100644 --- a/desktop/flipper-ui/src/Client.tsx +++ b/desktop/flipper-ui/src/Client.tsx @@ -259,10 +259,12 @@ export default class Client extends EventEmitter { }, ); this.plugins = new Set(response.plugins ?? []); - console.info( - `Received plugins from '${this.query.app}' on device '${this.query.device}'`, - [...this.plugins], - ); + if (process.env.NODE_ENV !== 'test') { + console.info( + `Received plugins from '${this.query.app}' on device '${this.query.device}'`, + [...this.plugins], + ); + } if (phase === 'init') { await this.waitForPluginsInit(); } diff --git a/desktop/flipper-ui/src/dispatcher/flipperServer.tsx b/desktop/flipper-ui/src/dispatcher/flipperServer.tsx index bc31d325dc5..649c312e602 100644 --- a/desktop/flipper-ui/src/dispatcher/flipperServer.tsx +++ b/desktop/flipper-ui/src/dispatcher/flipperServer.tsx @@ -361,7 +361,7 @@ export function handleDeviceConnected( .connections.devices.find((device) => device.serial === deviceInfo.serial); // handled outside reducer, as it might emit new redux actions... if (existing) { - if (existing.connected.get()) { + if (existing.connected.get() && process.env.NODE_ENV !== 'test') { console.warn( `Tried to replace still connected device '${existing.serial}' with a new instance.`, ); @@ -474,9 +474,11 @@ export async function handleClientConnected( }); } - console.log( - `Searching matching device ${query.device_id} for client ${query.app}...`, - ); + if (process.env.NODE_ENV !== 'test') { + console.log( + `Searching matching device ${query.device_id} for client ${query.app}...`, + ); + } const device = getDeviceBySerial(store.getState(), query.device_id) ?? (await findDeviceForConnection(store, query.app, query.device_id).catch( @@ -537,7 +539,9 @@ export async function handleClientConnected( client.init(), `Failed to initialize client ${query.app} on ${query.device_id} in a timely manner`, ); - console.log(`${query.app} on ${query.device_id} connected and ready.`); + if (process.env.NODE_ENV !== 'test') { + console.log(`${query.app} on ${query.device_id} connected and ready.`); + } } catch (e) { if (e instanceof NoLongerConnectedToClientError) { console.warn( diff --git a/desktop/patches/antd+4.24.13.patch b/desktop/patches/antd+4.24.13.patch index 4bdebb2629f..327c3eb67c1 100644 --- a/desktop/patches/antd+4.24.13.patch +++ b/desktop/patches/antd+4.24.13.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/antd/es/button/button.js b/node_modules/antd/es/button/button.js -index 635e056..611d5b4 100644 +index 635e056..805ebfa 100644 --- a/node_modules/antd/es/button/button.js +++ b/node_modules/antd/es/button/button.js @@ -165,6 +165,7 @@ var InternalButton = function InternalButton(props, ref) { @@ -25,8 +25,21 @@ index 635e056..611d5b4 100644 }; process.env.NODE_ENV !== "production" ? warning(!(typeof icon === 'string' && icon.length > 2), 'Button', "`icon` is using ReactNode instead of string naming in v4. Please check `".concat(icon, "` at https://ant.design/components/icon")) : void 0; process.env.NODE_ENV !== "production" ? warning(!(ghost && isUnBorderedButtonType(type)), 'Button', "`link` or `text` button can't be a `ghost` button.") : void 0; +diff --git a/node_modules/antd/es/tabs/hooks/useLegacyItems.js b/node_modules/antd/es/tabs/hooks/useLegacyItems.js +index 5f06ff5..568f3b5 100644 +--- a/node_modules/antd/es/tabs/hooks/useLegacyItems.js ++++ b/node_modules/antd/es/tabs/hooks/useLegacyItems.js +@@ -19,7 +19,7 @@ export default function useLegacyItems(items, children) { + if (items) { + return items; + } +- process.env.NODE_ENV !== "production" ? warning(!children, 'Tabs', 'Tabs.TabPane is deprecated. Please use `items` directly.') : void 0; ++ // process.env.NODE_ENV !== "production" ? warning(!children, 'Tabs', 'Tabs.TabPane is deprecated. Please use `items` directly.') : void 0; + var childrenItems = toArray(children).map(function (node) { + if ( /*#__PURE__*/React.isValidElement(node)) { + var key = node.key, diff --git a/node_modules/antd/es/typography/Link.js b/node_modules/antd/es/typography/Link.js -index 9156f1d..3978c6a 100644 +index 9156f1d..0d6090c 100644 --- a/node_modules/antd/es/typography/Link.js +++ b/node_modules/antd/es/typography/Link.js @@ -19,12 +19,24 @@ var Link = /*#__PURE__*/React.forwardRef(function (_a, ref) { @@ -55,3 +68,30 @@ index 9156f1d..3978c6a 100644 })); }); export default Link; +\ No newline at end of file +diff --git a/node_modules/antd/lib/dropdown/dropdown.js b/node_modules/antd/lib/dropdown/dropdown.js +index 05175ab..cf735f2 100644 +--- a/node_modules/antd/lib/dropdown/dropdown.js ++++ b/node_modules/antd/lib/dropdown/dropdown.js +@@ -39,7 +39,7 @@ var Dropdown = function Dropdown(props) { + newName = _ref2[1]; + process.env.NODE_ENV !== "production" ? (0, _warning["default"])(!(deprecatedName in props), 'Dropdown', "`".concat(deprecatedName, "` is deprecated which will be removed in next major version, please use `").concat(newName, "` instead.")) : void 0; + }); +- process.env.NODE_ENV !== "production" ? (0, _warning["default"])(!('overlay' in props), 'Dropdown', '`overlay` is deprecated. Please use `menu` instead.') : void 0; ++ // process.env.NODE_ENV !== "production" ? (0, _warning["default"])(!('overlay' in props), 'Dropdown', '`overlay` is deprecated. Please use `menu` instead.') : void 0; + } + var getTransitionName = function getTransitionName() { + var rootPrefixCls = getPrefixCls(); +diff --git a/node_modules/antd/lib/tabs/hooks/useLegacyItems.js b/node_modules/antd/lib/tabs/hooks/useLegacyItems.js +index 7cf5363..45c579e 100644 +--- a/node_modules/antd/lib/tabs/hooks/useLegacyItems.js ++++ b/node_modules/antd/lib/tabs/hooks/useLegacyItems.js +@@ -27,7 +27,7 @@ function useLegacyItems(items, children) { + if (items) { + return items; + } +- process.env.NODE_ENV !== "production" ? (0, _warning["default"])(!children, 'Tabs', 'Tabs.TabPane is deprecated. Please use `items` directly.') : void 0; ++ // process.env.NODE_ENV !== "production" ? (0, _warning["default"])(!children, 'Tabs', 'Tabs.TabPane is deprecated. Please use `items` directly.') : void 0; + var childrenItems = (0, _toArray["default"])(children).map(function (node) { + if ( /*#__PURE__*/React.isValidElement(node)) { + var key = node.key, diff --git a/desktop/patches/react-dom+0.0.0-experimental-14c2be8da-20220304.patch b/desktop/patches/react-dom+0.0.0-experimental-14c2be8da-20220304.patch new file mode 100644 index 00000000000..8753e2d03ec --- /dev/null +++ b/desktop/patches/react-dom+0.0.0-experimental-14c2be8da-20220304.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/react-dom/cjs/react-dom.development.js b/node_modules/react-dom/cjs/react-dom.development.js +index ae216b2..02c457f 100644 +--- a/node_modules/react-dom/cjs/react-dom.development.js ++++ b/node_modules/react-dom/cjs/react-dom.development.js +@@ -83,7 +83,9 @@ function printWarning(level, format, args) { + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging + +- Function.prototype.apply.call(console[level], console, argsWithFormat); ++ if (process.env.NODE_ENV !== "test") { ++ Function.prototype.apply.call(console[level], console, argsWithFormat); ++ } + } + } + diff --git a/desktop/plugins/public/logs/__tests__/logs.node.tsx b/desktop/plugins/public/logs/__tests__/logs.node.tsx index 0588c253309..12046400dd6 100644 --- a/desktop/plugins/public/logs/__tests__/logs.node.tsx +++ b/desktop/plugins/public/logs/__tests__/logs.node.tsx @@ -107,7 +107,6 @@ test('it supports deeplink and select nodes + navigating to bottom', async () => await sleep(1000); const current = instance.tableManagerRef.current; - console.error('ref', current); expect(current?.getSelectedItems()).toEqual([ { ...entry2,