diff --git a/src/test/suite/oidc.test.ts b/src/test/suite/oidc.test.ts index d882b8e41..ff2579ffd 100644 --- a/src/test/suite/oidc.test.ts +++ b/src/test/suite/oidc.test.ts @@ -9,6 +9,7 @@ import * as vscode from 'vscode'; import { createHash } from 'crypto'; import { before, after, afterEach, beforeEach } from 'mocha'; import EventEmitter, { once } from 'events'; +import util from 'util'; import { ExtensionContextStub } from './stubs'; import { StorageController } from '../../storage'; import { TelemetryService } from '../../telemetry'; @@ -24,6 +25,10 @@ import { ConnectionString } from 'mongodb-connection-string-url'; import launchMongoShell from '../../commands/launchMongoShell'; import { getFullRange } from './suggestTestHelpers'; +const sleep = (ms: number): Promise => { + return util.promisify(setTimeout)(ms); +}; + chai.use(chaiAsPromised); function hash(input: string): string { @@ -400,6 +405,7 @@ suite('OIDC Tests', function () { } await reAuthPromise; + await sleep(100); // Because we declined the auth in showInformationMessage above expect(tokenFetchCalls).to.equal(1);