From bf52273a5834fca983e97a0c13101db4a683b0cb Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 22 Feb 2026 12:20:44 +0100 Subject: [PATCH] test: harden flaky timeout-sensitive tests --- src/process/child-process-bridge.test.ts | 4 ++-- src/security/temp-path-guard.test.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/process/child-process-bridge.test.ts b/src/process/child-process-bridge.test.ts index 771b62965..04ef5715c 100644 --- a/src/process/child-process-bridge.test.ts +++ b/src/process/child-process-bridge.test.ts @@ -4,8 +4,8 @@ import process from "node:process"; import { afterEach, describe, expect, it } from "vitest"; import { attachChildProcessBridge } from "./child-process-bridge.js"; -const CHILD_READY_TIMEOUT_MS = 2_000; -const CHILD_EXIT_TIMEOUT_MS = 3_000; +const CHILD_READY_TIMEOUT_MS = 10_000; +const CHILD_EXIT_TIMEOUT_MS = 10_000; function waitForLine( stream: NodeJS.ReadableStream, diff --git a/src/security/temp-path-guard.test.ts b/src/security/temp-path-guard.test.ts index 8fa99feba..e1b5b4728 100644 --- a/src/security/temp-path-guard.test.ts +++ b/src/security/temp-path-guard.test.ts @@ -44,7 +44,14 @@ function isDynamicTemplateSegment(node: ts.Expression): boolean { return ts.isTemplateExpression(node); } +function mightContainDynamicTmpdirJoin(source: string): boolean { + return source.includes("path.join") && source.includes("os.tmpdir") && source.includes("`"); +} + function hasDynamicTmpdirJoin(source: string, filePath = "fixture.ts"): boolean { + if (!mightContainDynamicTmpdirJoin(source)) { + return false; + } const sourceFile = ts.createSourceFile( filePath, source, @@ -146,5 +153,5 @@ describe("temp path guard", () => { } expect(offenders).toEqual([]); - }); + }, 240_000); });