Improve unit test robustness

Summary: When running tests locally, some are quite flaky, and there is a lot of error logging noise. This diff doesn't remove all of it, but does reduce it significantly.

Reviewed By: nikoant

Differential Revision: D20034619

fbshipit-source-id: 183f74475b644f803b2f92b1b1301f4d0f6e193a
This commit is contained in:
Michel Weststrate
2020-02-25 14:58:00 -08:00
committed by Facebook Github Bot
parent abb2dc72ee
commit 74004b6338
6 changed files with 19 additions and 11 deletions

View File

@@ -32,7 +32,10 @@ import JSDevice from './devices/JSDevice';
import {WebsocketClientFlipperConnection} from './utils/js-client/websocketClientFlipperConnection';
import querystring from 'querystring';
import {IncomingMessage} from 'http';
const ws = window.require('ws'); // Electron tries to get you to use browser's ws instead, so can't use import.
import {isTest} from './utils/isProduction';
// Electron tries to get you to use browser's ws instead, so can't use import.
// @ts-ignore
const ws = isTest() ? require('ws') : window.require('ws');
type ClientInfo = {
connection: FlipperClientConnection<any, any> | null | undefined;