test: harden flaky timeout-sensitive tests

This commit is contained in:
Peter Steinberger
2026-02-22 12:20:44 +01:00
parent 42f62821db
commit bf52273a58
2 changed files with 10 additions and 3 deletions

View File

@@ -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,

View File

@@ -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);
});