From 545132c5c8f238a633f7b547e8b77643474ce197 Mon Sep 17 00:00:00 2001 From: TEJA P C <39472754+PCTEJA@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:30:21 -0500 Subject: [PATCH] Give AttachProcessProvider suite the shared TEST_TIMEOUT On a cold start, the first test in this suite can exceed Mocha's 2s default timeout (initial module loading). When it times out, its still-pending async work completes during the next test and records extra calls on that test's sinon stubs, failing it intermittently (e.g. 'expected plainExec to be called once but it was called twice'). Use the repository's shared TEST_TIMEOUT (60s, src/test/constants.ts) for the suite, following the existing this.timeout(TEST_TIMEOUT) pattern used elsewhere in the test suite. Fixes #1031 --- src/test/unittest/attachQuickPick/provider.unit.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/unittest/attachQuickPick/provider.unit.test.ts b/src/test/unittest/attachQuickPick/provider.unit.test.ts index ad47c402..e0fb51ba 100644 --- a/src/test/unittest/attachQuickPick/provider.unit.test.ts +++ b/src/test/unittest/attachQuickPick/provider.unit.test.ts @@ -14,11 +14,17 @@ import { PsProcessParser } from '../../../extension/debugger/attachQuickPick/psP import { IAttachItem } from '../../../extension/debugger/attachQuickPick/types'; import { WmicProcessParser } from '../../../extension/debugger/attachQuickPick/wmicProcessParser'; import * as platform from '../../../extension/common/platform'; +import { TEST_TIMEOUT } from '../../constants'; import * as rawProcessApis from '../../../extension/common/process/rawProcessApis'; use(chaiAsPromised); -suite('Attach to process - process provider', () => { +suite('Attach to process - process provider', function () { + // Use the shared test timeout instead of the 2s Mocha default: on a cold + // start the first test in this suite can exceed 2s (initial module loading), + // and when it times out its still-pending async work leaks into the next + // test and pollutes that test's stub assertions (#1031). + this.timeout(TEST_TIMEOUT); let provider: AttachProcessProvider; let getOSTypeStub: sinon.SinonStub; let plainExecStub: sinon.SinonStub;