fix(ci): stabilize windows tests
This commit is contained in:
@@ -16,6 +16,8 @@ const echoAfterDelay = (message: string) =>
|
|||||||
joinCommands([shortDelayCmd, `echo ${message}`]);
|
joinCommands([shortDelayCmd, `echo ${message}`]);
|
||||||
const echoLines = (lines: string[]) =>
|
const echoLines = (lines: string[]) =>
|
||||||
joinCommands(lines.map((line) => `echo ${line}`));
|
joinCommands(lines.map((line) => `echo ${line}`));
|
||||||
|
const normalizeText = (value?: string) =>
|
||||||
|
(value ?? "").replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
|
||||||
|
|
||||||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
@@ -171,7 +173,7 @@ describe("bash tool backgrounding", () => {
|
|||||||
limit: 2,
|
limit: 2,
|
||||||
});
|
});
|
||||||
const textBlock = log.content.find((c) => c.type === "text");
|
const textBlock = log.content.find((c) => c.type === "text");
|
||||||
expect(textBlock?.text?.trim()).toBe("two\nthree");
|
expect(normalizeText(textBlock?.text)).toBe("two\nthree");
|
||||||
expect((log.details as { totalLines?: number }).totalLines).toBe(3);
|
expect((log.details as { totalLines?: number }).totalLines).toBe(3);
|
||||||
expect(status).toBe("completed");
|
expect(status).toBe("completed");
|
||||||
});
|
});
|
||||||
@@ -191,7 +193,7 @@ describe("bash tool backgrounding", () => {
|
|||||||
limit: 1,
|
limit: 1,
|
||||||
});
|
});
|
||||||
const textBlock = log.content.find((c) => c.type === "text");
|
const textBlock = log.content.find((c) => c.type === "text");
|
||||||
expect(textBlock?.text?.trim()).toBe("beta");
|
expect(normalizeText(textBlock?.text)).toBe("beta");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("scopes process sessions by scopeKey", async () => {
|
it("scopes process sessions by scopeKey", async () => {
|
||||||
|
|||||||
@@ -4,12 +4,16 @@ import path from "node:path";
|
|||||||
|
|
||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
const itUnix = process.platform === "win32" ? it.skip : it;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.resetModules();
|
vi.resetModules();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("resolvePythonExecutablePath", () => {
|
describe("resolvePythonExecutablePath", () => {
|
||||||
it("resolves a working python path and caches the result", async () => {
|
itUnix(
|
||||||
|
"resolves a working python path and caches the result",
|
||||||
|
async () => {
|
||||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-python-"));
|
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-python-"));
|
||||||
const originalPath = process.env.PATH;
|
const originalPath = process.env.PATH;
|
||||||
try {
|
try {
|
||||||
@@ -43,7 +47,9 @@ describe("resolvePythonExecutablePath", () => {
|
|||||||
process.env.PATH = originalPath;
|
process.env.PATH = originalPath;
|
||||||
await fs.rm(tmp, { recursive: true, force: true });
|
await fs.rm(tmp, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
}, 60_000);
|
},
|
||||||
|
60_000,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("ensureTailscaleEndpoint", () => {
|
describe("ensureTailscaleEndpoint", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user