From 52fca0859eecac09c798401714f334c4ce3c0111 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Fri, 19 Nov 2021 03:59:55 -0800 Subject: [PATCH] Fix debug output in unit tests Summary: unit tests for deeplinks were logging full device / client objects instances, changed it to log the meta data only (description resp. query). Since Jest buffers console output, this might even help test stability Maybe console.debug shouldn't even be printed in Jest? See next diff Reviewed By: passy Differential Revision: D32557412 fbshipit-source-id: ff7fbf0cb5d8684d5333a62dac02fd5a59a6e358 --- .../src/dispatcher/handleOpenPluginDeeplink.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx b/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx index 27cde6e0a..ef84a2f20 100644 --- a/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx +++ b/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx @@ -103,7 +103,14 @@ export async function handleOpenPluginDeeplink( title, isDevicePlugin, ); - console.debug('[deeplink] Selected device and client:', deviceOrClient); + console.debug( + '[deeplink] Selected device and client:', + deviceOrClient instanceof BaseDevice + ? deviceOrClient.description + : deviceOrClient instanceof Client + ? deviceOrClient.query + : deviceOrClient, + ); if ('errorState' in deviceOrClient) { trackInteraction({ state: deviceOrClient.errorState, @@ -117,8 +124,8 @@ export async function handleOpenPluginDeeplink( const device: BaseDevice = isDevicePlugin ? (deviceOrClient as BaseDevice) : (deviceOrClient as Client).device; - console.debug('[deeplink] Client: ', client); - console.debug('[deeplink] Device: ', device); + console.debug('[deeplink] Client: ', client?.query); + console.debug('[deeplink] Device: ', device?.description); // verify plugin supported by selected device / client if (isDevicePlugin && !device.supportsPlugin(pluginDefinition)) { @@ -484,7 +491,7 @@ async function selectDevicesAndClient( const availableDevices = findValidDevices(); console.debug( '[deeplink] selectDevicesAndClient found at least one more valid device:', - availableDevices, + availableDevices.map((d) => d.description), ); // device plugin if (isDevicePlugin) {