fix(test): extend watchdog for slow vitest shards

This commit is contained in:
Vincent Koc
2026-06-13 21:37:57 +08:00
parent 68e234f9e2
commit 27e24ca683
4 changed files with 97 additions and 15 deletions
+26
View File
@@ -7,6 +7,7 @@ import nodePath from "node:path";
import { setTimeout as delay } from "node:timers/promises";
import { describe, expect, it, vi } from "vitest";
import {
DEFAULT_EXTRA_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS,
DEFAULT_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS,
installVitestNoOutputWatchdog,
resolveDefaultVitestNoOutputTimeoutMs,
@@ -473,6 +474,7 @@ describe("scripts/run-vitest", () => {
it("uses a longer default stall watchdog for broad e2e and project shard configs", () => {
const timeout = String(DEFAULT_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS);
const extraLongTimeout = String(DEFAULT_EXTRA_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS);
for (const configArg of [
"--config=test/vitest/vitest.e2e.config.ts",
@@ -487,6 +489,16 @@ describe("scripts/run-vitest", () => {
OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS: timeout,
});
}
for (const configArg of [
"--config=test/vitest/vitest.contracts-plugin.config.ts",
"--config=test/vitest/vitest.infra.config.ts",
]) {
expect(resolveRunVitestSpawnEnv({ PATH: "/usr/bin" }, ["run", configArg])).toEqual({
PATH: "/usr/bin",
OPENCLAW_VITEST_NO_OUTPUT_HEARTBEAT_MS: "30000",
OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS: extraLongTimeout,
});
}
expect(
resolveDefaultVitestNoOutputTimeoutMs([
"run",
@@ -515,6 +527,20 @@ describe("scripts/run-vitest", () => {
"/repo/test/vitest/vitest.full-core-contracts.config.ts",
]),
).toBe(DEFAULT_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS);
expect(
resolveDefaultVitestNoOutputTimeoutMs([
"run",
"--config",
"/repo/test/vitest/vitest.contracts-plugin.config.ts",
]),
).toBe(DEFAULT_EXTRA_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS);
expect(
resolveDefaultVitestNoOutputTimeoutMs([
"run",
"--config",
"/repo/test/vitest/vitest.infra.config.ts",
]),
).toBe(DEFAULT_EXTRA_LONG_RUNNING_VITEST_NO_OUTPUT_TIMEOUT_MS);
});
it("does not default implicit interactive runs to the stall watchdog", () => {
+38
View File
@@ -2716,6 +2716,44 @@ describe("scripts/test-projects Vitest stall watchdog", () => {
);
});
it("extends the no-output watchdog for slow silent full-suite configs", () => {
const specs = applyDefaultVitestNoOutputTimeout(
[
{
config: "test/vitest/vitest.contracts-plugin.config.ts",
env: { PATH: "/usr/bin" },
includeFilePath: null,
includePatterns: null,
pnpmArgs: [],
watchMode: false,
},
{
config: "test/vitest/vitest.infra.config.ts",
env: { PATH: "/usr/bin" },
includeFilePath: null,
includePatterns: null,
pnpmArgs: [],
watchMode: false,
},
{
config: "test/vitest/vitest.extension-feishu.config.ts",
env: { PATH: "/usr/bin" },
includeFilePath: null,
includePatterns: null,
pnpmArgs: [],
watchMode: false,
},
],
{ env: { PATH: "/usr/bin" } },
);
expect(specs[0]?.env.OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS).toBe("2400000");
expect(specs[1]?.env.OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS).toBe("2400000");
expect(specs[2]?.env.OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS).toBe(
DEFAULT_TEST_PROJECTS_VITEST_NO_OUTPUT_TIMEOUT_MS,
);
});
it("keeps explicit watchdog settings and watch mode untouched", () => {
const specs = applyDefaultVitestNoOutputTimeout(
[