From 6ec2655d6cc27079104f654b9c53e617b192202d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:18:33 +0000 Subject: [PATCH] test: mock secrets binary in analyze-skips-agentic test to prevent Windows hook timeout The 'exits with code 0 and skips agentic gracefully for the bare analyze command when no project is configured' test was failing on Windows with 'a beforeEach/afterEach hook timed out'. The bare analyze command calls analyzeSecrets() on the change set. Without withSecretsBinaryInstalled(), the CLI tries to download the real sonar-secrets binary from binaries.sonarsource.com during the test. On Windows CI, this download (or the subsequent cleanup of the freshly-written binary file) causes harness.dispose() in afterEach to exceed Bun's default hook timeout. Add withSecretsBinaryInstalled() so the pre-built mock binary is used instead, matching the pattern of other tests in the same describe block that exercise the bare analyze command. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/integration/specs/analyze/analyze-sqaa.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/specs/analyze/analyze-sqaa.test.ts b/tests/integration/specs/analyze/analyze-sqaa.test.ts index b0126cabf..90244ff98 100644 --- a/tests/integration/specs/analyze/analyze-sqaa.test.ts +++ b/tests/integration/specs/analyze/analyze-sqaa.test.ts @@ -1128,7 +1128,12 @@ describe('analyze agentic — change-set mode (no --file)', () => { // Cloud auth but no extension registered. The bare `analyze` catch-all must // still skip agentic gracefully (Option A) rather than failing the command. - harness.withAuth(server.baseUrl(), VALID_TOKEN, TEST_ORG); + // withSecretsBinaryInstalled() avoids a real network download on Windows, + // which can cause the afterEach cleanup hook to time out. + harness + .state() + .withSecretsBinaryInstalled() + .withAuth(server.baseUrl(), VALID_TOKEN, TEST_ORG); commitFile(harness.cwd.path, 'README.md', 'hello'); harness.cwd.writeFile('app.ts', 'const a = 1;');