fix(ci): stabilize windows tests

This commit is contained in:
Peter Steinberger
2026-01-08 02:44:09 +00:00
parent f3f5e49d94
commit fbeb9e6775
10 changed files with 148 additions and 62 deletions

View File

@@ -49,11 +49,11 @@ describe("brew helpers", () => {
it("includes Linuxbrew bin/sbin in path candidates", () => {
const env: NodeJS.ProcessEnv = { HOMEBREW_PREFIX: "/custom/prefix" };
const dirs = resolveBrewPathDirs({ homeDir: "/home/test", env });
expect(dirs).toContain("/custom/prefix/bin");
expect(dirs).toContain("/custom/prefix/sbin");
expect(dirs).toContain(path.join("/custom/prefix", "bin"));
expect(dirs).toContain(path.join("/custom/prefix", "sbin"));
expect(dirs).toContain("/home/linuxbrew/.linuxbrew/bin");
expect(dirs).toContain("/home/linuxbrew/.linuxbrew/sbin");
expect(dirs).toContain("/home/test/.linuxbrew/bin");
expect(dirs).toContain("/home/test/.linuxbrew/sbin");
expect(dirs).toContain(path.join("/home/test", ".linuxbrew", "bin"));
expect(dirs).toContain(path.join("/home/test", ".linuxbrew", "sbin"));
});
});

View File

@@ -51,9 +51,10 @@ describe("control UI assets helpers", () => {
});
it("resolves dist control-ui index path for dist argv1", () => {
const argv1 = path.join("/tmp", "pkg", "dist", "index.js");
const argv1 = path.resolve("/tmp", "pkg", "dist", "index.js");
const distDir = path.dirname(argv1);
expect(resolveControlUiDistIndexPath(argv1)).toBe(
path.join("/tmp", "pkg", "dist", "control-ui", "index.html"),
path.join(distDir, "control-ui", "index.html"),
);
});
});

View File

@@ -5,6 +5,11 @@ import { describe, expect, it, vi } from "vitest";
import { HEARTBEAT_PROMPT } from "../auto-reply/heartbeat.js";
import * as replyModule from "../auto-reply/reply.js";
import type { ClawdbotConfig } from "../config/config.js";
import {
resolveAgentIdFromSessionKey,
resolveMainSessionKey,
resolveStorePath,
} from "../config/sessions.js";
import {
resolveHeartbeatIntervalMs,
resolveHeartbeatPrompt,
@@ -192,15 +197,24 @@ describe("runHeartbeatOnce", () => {
"{agentId}",
"sessions.json",
);
const storePath = path.join(tmpDir, "agents", "work", "sessions.json");
const replySpy = vi.spyOn(replyModule, "getReplyFromConfig");
try {
const cfg: ClawdbotConfig = {
routing: { defaultAgentId: "work" },
agent: { heartbeat: { every: "5m" } },
whatsapp: { allowFrom: ["*"] },
session: { store: storeTemplate },
};
const sessionKey = resolveMainSessionKey(cfg);
const agentId = resolveAgentIdFromSessionKey(sessionKey);
const storePath = resolveStorePath(storeTemplate, { agentId });
await fs.mkdir(path.dirname(storePath), { recursive: true });
await fs.writeFile(
storePath,
JSON.stringify(
{
"agent:work:main": {
[sessionKey]: {
sessionId: "sid",
updatedAt: Date.now(),
lastProvider: "whatsapp",
@@ -212,13 +226,6 @@ describe("runHeartbeatOnce", () => {
),
);
const cfg: ClawdbotConfig = {
routing: { defaultAgentId: "work" },
agent: { heartbeat: { every: "5m" } },
whatsapp: { allowFrom: ["*"] },
session: { store: storeTemplate },
};
replySpy.mockResolvedValue({ text: "Hello from heartbeat" });
const sendWhatsApp = vi.fn().mockResolvedValue({
messageId: "m1",