test: harden flaky timeout-sensitive tests
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user