





















@@ -1,6 +1,9 @@
11import path from "node:path";
22import { describe, expect, it } from "vitest";
33import {
4+DEFAULT_TEST_PROJECTS_VITEST_NO_OUTPUT_TIMEOUT_MS,
5+applyDefaultMultiSpecVitestCachePaths,
6+applyDefaultVitestNoOutputTimeout,
47applyParallelVitestCachePaths,
58buildFullSuiteVitestRunPlans,
69buildVitestRunPlans,
@@ -807,3 +810,127 @@ describe("scripts/test-projects parallel cache paths", () => {
807810expect(spec?.env.OPENCLAW_VITEST_FS_MODULE_CACHE_PATH).toBeUndefined();
808811});
809812});
813+814+describe("scripts/test-projects Vitest stall watchdog", () => {
815+it("adds a default no-output timeout to non-watch specs", () => {
816+const [spec] = applyDefaultVitestNoOutputTimeout(
817+[
818+{
819+config: "test/vitest/vitest.extension-feishu.config.ts",
820+env: { PATH: "/usr/bin" },
821+includeFilePath: null,
822+includePatterns: null,
823+pnpmArgs: [],
824+watchMode: false,
825+},
826+],
827+{ env: { PATH: "/usr/bin" } },
828+);
829+830+expect(spec?.env.OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS).toBe(
831+DEFAULT_TEST_PROJECTS_VITEST_NO_OUTPUT_TIMEOUT_MS,
832+);
833+});
834+835+it("keeps explicit watchdog settings and watch mode untouched", () => {
836+const specs = applyDefaultVitestNoOutputTimeout(
837+[
838+{
839+config: "test/vitest/vitest.extension-feishu.config.ts",
840+env: { PATH: "/usr/bin" },
841+includeFilePath: null,
842+includePatterns: null,
843+pnpmArgs: [],
844+watchMode: true,
845+},
846+{
847+config: "test/vitest/vitest.extension-memory.config.ts",
848+env: { OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS: "0", PATH: "/usr/bin" },
849+includeFilePath: null,
850+includePatterns: null,
851+pnpmArgs: [],
852+watchMode: false,
853+},
854+],
855+{ env: { PATH: "/usr/bin" } },
856+);
857+858+expect(specs[0]?.env.OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS).toBeUndefined();
859+expect(specs[1]?.env.OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS).toBe("0");
860+});
861+});
862+863+describe("scripts/test-projects Vitest cache isolation", () => {
864+it("assigns isolated fs-module caches to multi-spec non-watch runs", () => {
865+const specs = applyDefaultMultiSpecVitestCachePaths(
866+[
867+{
868+config: "test/vitest/vitest.unit-fast.config.ts",
869+env: {},
870+includeFilePath: null,
871+includePatterns: null,
872+pnpmArgs: [],
873+watchMode: false,
874+},
875+{
876+config: "test/vitest/vitest.extension-memory.config.ts",
877+env: {},
878+includeFilePath: null,
879+includePatterns: null,
880+pnpmArgs: [],
881+watchMode: false,
882+},
883+],
884+{ cwd: "/repo", env: {} },
885+);
886+887+expect(specs.map((spec) => spec.env.OPENCLAW_VITEST_FS_MODULE_CACHE_PATH)).toEqual([
888+path.join(
889+"/repo",
890+"node_modules",
891+".experimental-vitest-cache",
892+"0-test-vitest-vitest.unit-fast.config.ts",
893+),
894+path.join(
895+"/repo",
896+"node_modules",
897+".experimental-vitest-cache",
898+"1-test-vitest-vitest.extension-memory.config.ts",
899+),
900+]);
901+});
902+903+it("keeps single-spec and watch runs on the default cache", () => {
904+const single = [
905+{
906+config: "test/vitest/vitest.unit-fast.config.ts",
907+env: {},
908+includeFilePath: null,
909+includePatterns: null,
910+pnpmArgs: [],
911+watchMode: false,
912+},
913+];
914+expect(applyDefaultMultiSpecVitestCachePaths(single, { cwd: "/repo", env: {} })).toBe(single);
915+916+const watch = [
917+{
918+config: "vitest.config.ts",
919+env: {},
920+includeFilePath: null,
921+includePatterns: null,
922+pnpmArgs: [],
923+watchMode: true,
924+},
925+{
926+config: "test/vitest/vitest.unit-fast.config.ts",
927+env: {},
928+includeFilePath: null,
929+includePatterns: null,
930+pnpmArgs: [],
931+watchMode: false,
932+},
933+];
934+expect(applyDefaultMultiSpecVitestCachePaths(watch, { cwd: "/repo", env: {} })).toBe(watch);
935+});
936+});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。