From 8c396d05128e4ce18a2b28c4c58ab4b69a550e92 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 27 Oct 2020 10:53:27 -0700 Subject: [PATCH] test: deflake ses.setProxy test (#26167) --- spec-main/api-session-spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec-main/api-session-spec.ts b/spec-main/api-session-spec.ts index a6dfa90afa87..3ff318fc7ce3 100644 --- a/spec-main/api-session-spec.ts +++ b/spec-main/api-session-spec.ts @@ -9,7 +9,7 @@ import * as send from 'send'; import * as auth from 'basic-auth'; import { closeAllWindows } from './window-helpers'; import { emittedOnce } from './events-helpers'; -import { defer } from './spec-helpers'; +import { defer, delay } from './spec-helpers'; import { AddressInfo } from 'net'; /* The whole session API doesn't use standard callbacks */ @@ -341,9 +341,16 @@ describe('session module', () => { describe('ses.setProxy(options)', () => { let server: http.Server; let customSession: Electron.Session; + let created = false; beforeEach(async () => { customSession = session.fromPartition('proxyconfig'); + if (!created) { + // Work around for https://github.com/electron/electron/issues/26166 to + // reduce flake + await delay(100); + created = true; + } }); afterEach(() => {