refactor: migrate test runner from vitest to bun:test #602

Merged
xiaomo merged 1 commits from refactor/vitest-to-bun-test into main 2026-06-02 11:02:12 +00:00
68 changed files with 116 additions and 197 deletions
-1
View File
@@ -28,7 +28,6 @@
"@uncaged/workflow-agent-hermes": "workspace:*", "@uncaged/workflow-agent-hermes": "workspace:*",
"bun-types": "^1.3.13", "bun-types": "^1.3.13",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"vitest": "^4.1.7",
"yaml": "^2.9.0" "yaml": "^2.9.0"
}, },
"repository": { "repository": {
+3 -4
View File
@@ -23,15 +23,14 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test src/",
"test:ci": "vitest run" "test:ci": "bun test src/"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"devDependencies": { "devDependencies": {
"@types/mustache": "^4.2.6", "@types/mustache": "^4.2.6"
"vitest": "^4.1.6"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -1,3 +1,4 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { execFileSync } from "node:child_process"; import { execFileSync } from "node:child_process";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
@@ -5,7 +6,6 @@ import { join } from "node:path";
import { putSchema } from "@ocas/core"; import { putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
import { saveThreadsIndex } from "../store.js"; import { saveThreadsIndex } from "../store.js";
@@ -1,8 +1,8 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { execSync } from "node:child_process"; import { execSync } from "node:child_process";
import { mkdir, rm } from "node:fs/promises"; import { mkdir, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdCasPutText } from "../commands/cas.js"; import { cmdCasPutText } from "../commands/cas.js";
let storageRoot: string; let storageRoot: string;
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, rm } from "node:fs/promises"; import { mkdir, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdCasHas, cmdCasPutText } from "../commands/cas.js"; import { cmdCasHas, cmdCasPutText } from "../commands/cas.js";
let storageRoot: string; let storageRoot: string;
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test";
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { import {
cmdConfigGet, cmdConfigGet,
cmdConfigList, cmdConfigList,
@@ -1,9 +1,9 @@
import { describe, expect, test } from "bun:test";
import { mkdir, rm, writeFile } from "node:fs/promises"; import { mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { putSchema } from "@ocas/core"; import { putSchema } from "@ocas/core";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { createMarker, deleteMarker } from "../background/index.js"; import { createMarker, deleteMarker } from "../background/index.js";
import { cmdThreadList, cmdThreadShow, cmdThreadStart } from "../commands/thread.js"; import { cmdThreadList, cmdThreadShow, cmdThreadStart } from "../commands/thread.js";
import { import {
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { parse } from "yaml"; import { parse } from "yaml";
import { createIncludeTag } from "../include.js"; import { createIncludeTag } from "../include.js";
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, readdir, rm, writeFile } from "node:fs/promises"; import { mkdir, readdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdLogClean, cmdLogList, cmdLogShow } from "../commands/log.js"; import { cmdLogClean, cmdLogList, cmdLogShow } from "../commands/log.js";
let storageRoot: string; let storageRoot: string;
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import type { Target, WorkflowPayload } from "@uncaged/workflow-protocol"; import type { Target, WorkflowPayload } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { evaluate } from "../moderator/evaluate.js"; import { evaluate } from "../moderator/evaluate.js";
@@ -0,0 +1,7 @@
const originalExit = process.exit;
process.exit = ((code?: number) => {
throw new Error(`process.exit(${code ?? 1})`);
}) as typeof process.exit;
export { originalExit };
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test";
import { execFileSync } from "node:child_process"; import { execFileSync } from "node:child_process";
import { dirname, join } from "node:path"; import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { describe, expect, test } from "vitest";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -1,8 +1,8 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdtemp, rm } from "node:fs/promises"; import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { resolveHeadHash } from "../commands/shared.js"; import { resolveHeadHash } from "../commands/shared.js";
import { appendThreadHistory, saveThreadsIndex } from "../store.js"; import { appendThreadHistory, saveThreadsIndex } from "../store.js";
@@ -1,8 +1,8 @@
import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from "bun:test";
import { readFileSync } from "node:fs"; import { readFileSync } from "node:fs";
import { mkdtemp, rm } from "node:fs/promises"; import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { parse } from "yaml"; import { parse } from "yaml";
import { _agentNameFromBinary, _printAgentMenu, cmdSetup } from "../commands/setup.js"; import { _agentNameFromBinary, _printAgentMenu, cmdSetup } from "../commands/setup.js";
@@ -31,7 +31,7 @@ describe("_agentNameFromBinary", () => {
describe("_printAgentMenu", () => { describe("_printAgentMenu", () => {
test("prints known agents with labels", () => { test("prints known agents with labels", () => {
const logs: string[] = []; const logs: string[] = [];
vi.spyOn(console, "log").mockImplementation((...args: unknown[]) => { spyOn(console, "log").mockImplementation((...args: unknown[]) => {
logs.push(args.join(" ")); logs.push(args.join(" "));
}); });
@@ -40,12 +40,12 @@ describe("_printAgentMenu", () => {
expect(logs.some((l) => l.includes("Hermes"))).toBe(true); expect(logs.some((l) => l.includes("Hermes"))).toBe(true);
expect(logs.some((l) => l.includes("Claude Code"))).toBe(true); expect(logs.some((l) => l.includes("Claude Code"))).toBe(true);
vi.restoreAllMocks(); mock.restore();
}); });
test("prints unknown agents with binary name as label", () => { test("prints unknown agents with binary name as label", () => {
const logs: string[] = []; const logs: string[] = [];
vi.spyOn(console, "log").mockImplementation((...args: unknown[]) => { spyOn(console, "log").mockImplementation((...args: unknown[]) => {
logs.push(args.join(" ")); logs.push(args.join(" "));
}); });
@@ -53,7 +53,7 @@ describe("_printAgentMenu", () => {
expect(logs.some((l) => l.includes("uwf-custom-agent"))).toBe(true); expect(logs.some((l) => l.includes("uwf-custom-agent"))).toBe(true);
vi.restoreAllMocks(); mock.restore();
}); });
}); });
@@ -67,7 +67,7 @@ describe("cmdSetup agent configuration", () => {
}); });
afterEach(async () => { afterEach(async () => {
vi.restoreAllMocks(); mock.restore();
await rm(storageRoot, { recursive: true, force: true }); await rm(storageRoot, { recursive: true, force: true });
}); });
@@ -80,9 +80,7 @@ describe("cmdSetup agent configuration", () => {
}); });
test("defaults to hermes agent when no agent specified", async () => { test("defaults to hermes agent when no agent specified", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
const result = await cmdSetup(baseArgs()); const result = await cmdSetup(baseArgs());
@@ -93,9 +91,7 @@ describe("cmdSetup agent configuration", () => {
}); });
test("writes specified agent as default", async () => { test("writes specified agent as default", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
const result = await cmdSetup({ ...baseArgs(), agent: "claude-code" }); const result = await cmdSetup({ ...baseArgs(), agent: "claude-code" });
@@ -106,9 +102,7 @@ describe("cmdSetup agent configuration", () => {
}); });
test("preserves existing agents when adding new one", async () => { test("preserves existing agents when adding new one", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
// First setup with hermes // First setup with hermes
await cmdSetup(baseArgs()); await cmdSetup(baseArgs());
@@ -122,9 +116,7 @@ describe("cmdSetup agent configuration", () => {
}); });
test("updates defaultAgent on re-run with different agent", async () => { test("updates defaultAgent on re-run with different agent", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
await cmdSetup(baseArgs()); await cmdSetup(baseArgs());
const config1 = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8")); const config1 = parse(readFileSync(join(storageRoot, "config.yaml"), "utf8"));
@@ -136,9 +128,7 @@ describe("cmdSetup agent configuration", () => {
}); });
test("normalizes agent name with uwf- prefix to bare name", async () => { test("normalizes agent name with uwf- prefix to bare name", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
const result = await cmdSetup({ ...baseArgs(), agent: "uwf-hermes" }); const result = await cmdSetup({ ...baseArgs(), agent: "uwf-hermes" });
@@ -151,9 +141,7 @@ describe("cmdSetup agent configuration", () => {
}); });
test("normalizes uwf-claude-code to claude-code", async () => { test("normalizes uwf-claude-code to claude-code", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
const result = await cmdSetup({ ...baseArgs(), agent: "uwf-claude-code" }); const result = await cmdSetup({ ...baseArgs(), agent: "uwf-claude-code" });
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, mock, spyOn, test } from "bun:test";
import { mkdirSync, writeFileSync } from "node:fs"; import { mkdirSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, describe, expect, test, vi } from "vitest";
import { import {
_discoverAgents, _discoverAgents,
_isBackspace, _isBackspace,
@@ -178,7 +178,7 @@ describe("_isBackspace", () => {
describe("_printProviderMenu", () => { describe("_printProviderMenu", () => {
afterEach(() => { afterEach(() => {
vi.restoreAllMocks(); mock.restore();
}); });
const providers = [ const providers = [
@@ -188,7 +188,7 @@ describe("_printProviderMenu", () => {
test("prints correct number of lines (one per provider + custom)", () => { test("prints correct number of lines (one per provider + custom)", () => {
const lines: string[] = []; const lines: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
lines.push(msg); lines.push(msg);
}); });
_printProviderMenu(providers); _printProviderMenu(providers);
@@ -198,7 +198,7 @@ describe("_printProviderMenu", () => {
test("custom option number = providers.length + 1", () => { test("custom option number = providers.length + 1", () => {
const lines: string[] = []; const lines: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
lines.push(msg); lines.push(msg);
}); });
_printProviderMenu(providers); _printProviderMenu(providers);
@@ -208,7 +208,7 @@ describe("_printProviderMenu", () => {
test("each provider line contains its label and baseUrl", () => { test("each provider line contains its label and baseUrl", () => {
const lines: string[] = []; const lines: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
lines.push(msg); lines.push(msg);
}); });
_printProviderMenu(providers); _printProviderMenu(providers);
@@ -294,12 +294,12 @@ describe("_resolveModelChoice", () => {
describe("_printModelMenu", () => { describe("_printModelMenu", () => {
afterEach(() => { afterEach(() => {
vi.restoreAllMocks(); mock.restore();
}); });
test("prints all models — each model name appears in output", () => { test("prints all models — each model name appears in output", () => {
const output: string[] = []; const output: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
output.push(msg); output.push(msg);
}); });
const models = ["model-a", "model-b", "model-c"]; const models = ["model-a", "model-b", "model-c"];
@@ -312,7 +312,7 @@ describe("_printModelMenu", () => {
test("single column when termCols is very small", () => { test("single column when termCols is very small", () => {
const output: string[] = []; const output: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
output.push(msg); output.push(msg);
}); });
_printModelMenu(["a", "b", "c"], 1); _printModelMenu(["a", "b", "c"], 1);
@@ -322,7 +322,7 @@ describe("_printModelMenu", () => {
test("wide terminal fits multiple columns", () => { test("wide terminal fits multiple columns", () => {
const output: string[] = []; const output: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
output.push(msg); output.push(msg);
}); });
const models = Array.from({ length: 6 }, (_, i) => `m${i}`); const models = Array.from({ length: 6 }, (_, i) => `m${i}`);
@@ -338,12 +338,12 @@ describe("_printModelMenu", () => {
describe("_printValidationResult", () => { describe("_printValidationResult", () => {
afterEach(() => { afterEach(() => {
vi.restoreAllMocks(); mock.restore();
}); });
test("ok=true prints success message containing '✓'", () => { test("ok=true prints success message containing '✓'", () => {
const lines: string[] = []; const lines: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
lines.push(msg); lines.push(msg);
}); });
_printValidationResult({ ok: true, error: null }); _printValidationResult({ ok: true, error: null });
@@ -352,7 +352,7 @@ describe("_printValidationResult", () => {
test("ok=false prints warning message containing '⚠'", () => { test("ok=false prints warning message containing '⚠'", () => {
const lines: string[] = []; const lines: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
lines.push(msg); lines.push(msg);
}); });
_printValidationResult({ ok: false, error: "HTTP 401" }); _printValidationResult({ ok: false, error: "HTTP 401" });
@@ -361,7 +361,7 @@ describe("_printValidationResult", () => {
test("ok=false includes the error string in output", () => { test("ok=false includes the error string in output", () => {
const lines: string[] = []; const lines: string[] = [];
vi.spyOn(console, "log").mockImplementation((msg: string) => { spyOn(console, "log").mockImplementation((msg: string) => {
lines.push(msg); lines.push(msg);
}); });
_printValidationResult({ ok: false, error: "HTTP 401" }); _printValidationResult({ ok: false, error: "HTTP 401" });
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from "bun:test";
import { mkdtemp, rm } from "node:fs/promises"; import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { cmdSetup, validateModel } from "../commands/setup.js"; import { cmdSetup, validateModel } from "../commands/setup.js";
describe("validateModel", () => { describe("validateModel", () => {
@@ -10,18 +10,18 @@ describe("validateModel", () => {
const MODEL = "test-model"; const MODEL = "test-model";
afterEach(() => { afterEach(() => {
vi.restoreAllMocks(); mock.restore();
}); });
test("success path — returns ok on 200", async () => { test("success path — returns ok on 200", async () => {
const mockFetch = vi const mockFetch = spyOn(globalThis, "fetch").mockResolvedValue(
.spyOn(globalThis, "fetch") new Response(JSON.stringify({}), { status: 200 }),
.mockResolvedValue(new Response(JSON.stringify({}), { status: 200 })); );
const result = await validateModel(BASE_URL, API_KEY, MODEL); const result = await validateModel(BASE_URL, API_KEY, MODEL);
expect(result).toEqual({ ok: true, value: undefined }); expect(result).toEqual({ ok: true, value: undefined });
expect(mockFetch).toHaveBeenCalledOnce(); expect(mockFetch).toHaveBeenCalledTimes(1);
const [url, opts] = mockFetch.mock.calls[0]!; const [url, opts] = mockFetch.mock.calls[0]!;
expect(url).toBe(`${BASE_URL}/chat/completions`); expect(url).toBe(`${BASE_URL}/chat/completions`);
@@ -37,7 +37,7 @@ describe("validateModel", () => {
}); });
test("HTTP 401 — returns error containing 401", async () => { test("HTTP 401 — returns error containing 401", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(
new Response("Unauthorized", { status: 401, statusText: "Unauthorized" }), new Response("Unauthorized", { status: 401, statusText: "Unauthorized" }),
); );
@@ -50,7 +50,7 @@ describe("validateModel", () => {
}); });
test("HTTP 404 — returns error containing 404", async () => { test("HTTP 404 — returns error containing 404", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(
new Response("Not Found", { status: 404, statusText: "Not Found" }), new Response("Not Found", { status: 404, statusText: "Not Found" }),
); );
@@ -64,7 +64,7 @@ describe("validateModel", () => {
test("network timeout — returns error mentioning timeout", async () => { test("network timeout — returns error mentioning timeout", async () => {
const err = new DOMException("signal timed out", "AbortError"); const err = new DOMException("signal timed out", "AbortError");
vi.spyOn(globalThis, "fetch").mockRejectedValue(err); spyOn(globalThis, "fetch").mockRejectedValue(err);
const result = await validateModel(BASE_URL, API_KEY, MODEL); const result = await validateModel(BASE_URL, API_KEY, MODEL);
@@ -75,7 +75,7 @@ describe("validateModel", () => {
}); });
test("network error (DNS/connection) — returns error mentioning connectivity", async () => { test("network error (DNS/connection) — returns error mentioning connectivity", async () => {
vi.spyOn(globalThis, "fetch").mockRejectedValue(new TypeError("fetch failed")); spyOn(globalThis, "fetch").mockRejectedValue(new TypeError("fetch failed"));
const result = await validateModel(BASE_URL, API_KEY, MODEL); const result = await validateModel(BASE_URL, API_KEY, MODEL);
@@ -86,9 +86,9 @@ describe("validateModel", () => {
}); });
test("request body correctness", async () => { test("request body correctness", async () => {
const mockFetch = vi const mockFetch = spyOn(globalThis, "fetch").mockResolvedValue(
.spyOn(globalThis, "fetch") new Response(JSON.stringify({}), { status: 200 }),
.mockResolvedValue(new Response(JSON.stringify({}), { status: 200 })); );
await validateModel(BASE_URL, API_KEY, "my-special-model"); await validateModel(BASE_URL, API_KEY, "my-special-model");
@@ -109,7 +109,7 @@ describe("cmdSetup with validation", () => {
}); });
afterEach(async () => { afterEach(async () => {
vi.restoreAllMocks(); mock.restore();
await rm(storageRoot, { recursive: true, force: true }); await rm(storageRoot, { recursive: true, force: true });
}); });
@@ -122,9 +122,7 @@ describe("cmdSetup with validation", () => {
}); });
test("includes validation result on success", async () => { test("includes validation result on success", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(new Response(JSON.stringify({}), { status: 200 }));
new Response(JSON.stringify({}), { status: 200 }),
);
const result = await cmdSetup(setupArgs()); const result = await cmdSetup(setupArgs());
@@ -134,7 +132,7 @@ describe("cmdSetup with validation", () => {
}); });
test("includes validation failure — config still saved", async () => { test("includes validation failure — config still saved", async () => {
vi.spyOn(globalThis, "fetch").mockResolvedValue( spyOn(globalThis, "fetch").mockResolvedValue(
new Response("Unauthorized", { status: 401, statusText: "Unauthorized" }), new Response("Unauthorized", { status: 401, statusText: "Unauthorized" }),
); );
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test";
import { readFile } from "node:fs/promises"; import { readFile } from "node:fs/promises";
import { join } from "node:path"; import { join } from "node:path";
import type { WorkflowPayload } from "@uncaged/workflow-protocol"; import type { WorkflowPayload } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { parse } from "yaml"; import { parse } from "yaml";
/** /**
@@ -1,4 +1,4 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "bun:test";
/** /**
* B-group tests: validate JSON parsing logic used by spawnAgent. * B-group tests: validate JSON parsing logic used by spawnAgent.
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { bootstrap, putSchema } from "@ocas/core"; import { bootstrap, putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef } from "@uncaged/workflow-protocol"; import type { CasRef } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdStepRead } from "../commands/step.js"; import { cmdStepRead } from "../commands/step.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { bootstrap, type Hash, type JSONSchema, putSchema } from "@ocas/core"; import { bootstrap, type Hash, type JSONSchema, putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, StepNodePayload } from "@uncaged/workflow-protocol"; import type { CasRef, StepNodePayload } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdStepShow } from "../commands/step.js"; import { cmdStepShow } from "../commands/step.js";
import { formatOutput } from "../format.js"; import { formatOutput } from "../format.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
@@ -1,3 +1,4 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
@@ -5,7 +6,6 @@ import { bootstrap, putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { STEP_NODE_SCHEMA } from "@uncaged/workflow-protocol"; import { STEP_NODE_SCHEMA } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdStepList } from "../commands/step.js"; import { cmdStepList } from "../commands/step.js";
import { cmdThreadRead } from "../commands/thread.js"; import { cmdThreadRead } from "../commands/thread.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, rm } from "node:fs/promises"; import { mkdir, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { createUwfStore, getCasDir, getGlobalCasDir } from "../store.js"; import { createUwfStore, getCasDir, getGlobalCasDir } from "../store.js";
describe("Global CAS directory", () => { describe("Global CAS directory", () => {
@@ -1,8 +1,8 @@
import { describe, expect, test } from "bun:test";
import { mkdtemp } from "node:fs/promises"; import { mkdtemp } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { appendThreadHistory, loadThreadHistory } from "../store.js"; import { appendThreadHistory, loadThreadHistory } from "../store.js";
describe("thread cancel status", () => { describe("thread cancel status", () => {
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { createThreadIndexEntry } from "@uncaged/workflow-protocol"; import { createThreadIndexEntry } from "@uncaged/workflow-protocol";
import { extractUlidTimestamp, generateUlid } from "@uncaged/workflow-util"; import { extractUlidTimestamp, generateUlid } from "@uncaged/workflow-util";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { createMarker, deleteMarker } from "../background/index.js"; import { createMarker, deleteMarker } from "../background/index.js";
import { cmdThreadList } from "../commands/thread.js"; import { cmdThreadList } from "../commands/thread.js";
import { parseTimeInput } from "../commands/thread-time-parser.js"; import { parseTimeInput } from "../commands/thread-time-parser.js";
@@ -1,8 +1,8 @@
import { describe, expect, test } from "bun:test";
import { mkdir, rm, writeFile } from "node:fs/promises"; import { mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import type { CasRef, StartNodePayload, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, StartNodePayload, ThreadId } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { cmdThreadStart } from "../commands/thread.js"; import { cmdThreadStart } from "../commands/thread.js";
import { createUwfStore } from "../store.js"; import { createUwfStore } from "../store.js";
@@ -128,7 +128,7 @@ graph:
const workflowPath = join(tmpDir, "test-location.yaml"); const workflowPath = join(tmpDir, "test-location.yaml");
await writeFile(workflowPath, workflowYaml, "utf8"); await writeFile(workflowPath, workflowYaml, "utf8");
// Relative path should fail (process.exit is wrapped by vitest) // Relative path should fail via fail() → process.exit (mocked in test preload)
await expect( await expect(
cmdThreadStart(storageRoot, workflowPath, "test", tmpDir, "relative/path"), cmdThreadStart(storageRoot, workflowPath, "test", tmpDir, "relative/path"),
).rejects.toThrow(); ).rejects.toThrow();
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { bootstrap, putSchema } from "@ocas/core"; import { bootstrap, putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdThreadRead } from "../commands/thread.js"; import { cmdThreadRead } from "../commands/thread.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
import { saveThreadsIndex } from "../store.js"; import { saveThreadsIndex } from "../store.js";
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { bootstrap, putSchema } from "@ocas/core"; import { bootstrap, putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdThreadRead, THREAD_READ_DEFAULT_QUOTA } from "../commands/thread.js"; import { cmdThreadRead, THREAD_READ_DEFAULT_QUOTA } from "../commands/thread.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
import type { UwfStore } from "../store.js"; import type { UwfStore } from "../store.js";
@@ -1,3 +1,4 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { execFileSync } from "node:child_process"; import { execFileSync } from "node:child_process";
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
@@ -5,7 +6,6 @@ import { join } from "node:path";
import { putSchema } from "@ocas/core"; import { putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { parse } from "yaml"; import { parse } from "yaml";
import { cmdThreadShow } from "../commands/thread.js"; import { cmdThreadShow } from "../commands/thread.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
@@ -1,9 +1,9 @@
import { describe, expect, test } from "bun:test";
import { mkdir, rm, writeFile } from "node:fs/promises"; import { mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { putSchema } from "@ocas/core"; import { putSchema } from "@ocas/core";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { createMarker, deleteMarker } from "../background/index.js"; import { createMarker, deleteMarker } from "../background/index.js";
import { cmdThreadShow, cmdThreadStart } from "../commands/thread.js"; import { cmdThreadShow, cmdThreadStart } from "../commands/thread.js";
import { import {
@@ -1,9 +1,9 @@
import { describe, expect, test } from "bun:test";
import { execFileSync } from "node:child_process"; import { execFileSync } from "node:child_process";
import { mkdir, rm, writeFile } from "node:fs/promises"; import { mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import type { CasRef, StartNodePayload, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, StartNodePayload, ThreadId } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { cmdThreadStart } from "../commands/thread.js"; import { cmdThreadStart } from "../commands/thread.js";
import { createUwfStore, loadThreadsIndex } from "../store.js"; import { createUwfStore, loadThreadsIndex } from "../store.js";
@@ -136,14 +136,14 @@ graph:
const uwfBin = join(process.cwd(), "dist", "cli.js"); const uwfBin = join(process.cwd(), "dist", "cli.js");
// Register the workflow // Register the workflow
execFileSync("node", [uwfBin, "workflow", "add", workflowPath], { execFileSync("bun", [uwfBin, "workflow", "add", workflowPath], {
env: { ...process.env, UWF_STORAGE_ROOT: storageRoot, UNCAGED_CAS_DIR: casDir }, env: { ...process.env, UWF_STORAGE_ROOT: storageRoot, UNCAGED_CAS_DIR: casDir },
encoding: "utf8", encoding: "utf8",
}); });
// Verify CLI accepts --cwd option (no error thrown) // Verify CLI accepts --cwd option (no error thrown)
const output = execFileSync( const output = execFileSync(
"node", "bun",
[uwfBin, "thread", "start", "test-cwd-cli", "-p", "test prompt", "--cwd", testCwd], [uwfBin, "thread", "start", "test-cwd-cli", "-p", "test prompt", "--cwd", testCwd],
{ {
env: { ...process.env, UWF_STORAGE_ROOT: storageRoot, UNCAGED_CAS_DIR: casDir }, env: { ...process.env, UWF_STORAGE_ROOT: storageRoot, UNCAGED_CAS_DIR: casDir },
@@ -1,6 +1,6 @@
import { describe, expect, test } from "bun:test";
import { execFileSync } from "node:child_process"; import { execFileSync } from "node:child_process";
import { join } from "node:path"; import { join } from "node:path";
import { describe, expect, test } from "vitest";
const CLI_PATH = join(import.meta.dirname, "..", "cli.js"); const CLI_PATH = join(import.meta.dirname, "..", "cli.js");
@@ -1,3 +1,4 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { execFileSync } from "node:child_process"; import { execFileSync } from "node:child_process";
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
@@ -5,7 +6,6 @@ import { join } from "node:path";
import { putSchema } from "@ocas/core"; import { putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, StepNodePayload, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { parse } from "yaml"; import { parse } from "yaml";
import { cmdThreadShow } from "../commands/thread.js"; import { cmdThreadShow } from "../commands/thread.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { putSchema } from "@ocas/core"; import { putSchema } from "@ocas/core";
import type { ThreadId } from "@uncaged/workflow-protocol"; import type { ThreadId } from "@uncaged/workflow-protocol";
import { createThreadIndexEntry, markThreadSuspended } from "@uncaged/workflow-protocol"; import { createThreadIndexEntry, markThreadSuspended } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdThreadList, cmdThreadShow } from "../commands/thread.js"; import { cmdThreadList, cmdThreadShow } from "../commands/thread.js";
import { createUwfStore, saveThreadsIndex } from "../store.js"; import { createUwfStore, saveThreadsIndex } from "../store.js";
@@ -1,10 +1,10 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm } from "node:fs/promises"; import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { bootstrap, putSchema } from "@ocas/core"; import { bootstrap, putSchema } from "@ocas/core";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, ThreadId } from "@uncaged/workflow-protocol"; import type { CasRef, ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { cmdStepList, cmdStepShow } from "../commands/step.js"; import { cmdStepList, cmdStepShow } from "../commands/step.js";
import { import {
cmdThreadRead, cmdThreadRead,
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import type { WorkflowPayload } from "@uncaged/workflow-protocol"; import type { WorkflowPayload } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { validateWorkflow } from "../validate-semantic.js"; import { validateWorkflow } from "../validate-semantic.js";
/** Build a valid two-role workflow that passes all checks. */ /** Build a valid two-role workflow that passes all checks. */
@@ -1,9 +1,9 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { join } from "node:path"; import { join } from "node:path";
import { createFsStore } from "@ocas/fs"; import { createFsStore } from "@ocas/fs";
import type { CasRef, WorkflowPayload } from "@uncaged/workflow-protocol"; import type { CasRef, WorkflowPayload } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { stringify } from "yaml"; import { stringify } from "yaml";
import { cmdThreadStart } from "../commands/thread.js"; import { cmdThreadStart } from "../commands/thread.js";
import { registerUwfSchemas } from "../schemas.js"; import { registerUwfSchemas } from "../schemas.js";
@@ -1,4 +1,4 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "bun:test";
import { evaluate } from "../evaluate.js"; import { evaluate } from "../evaluate.js";
import { isSuspendResult } from "../types.js"; import { isSuspendResult } from "../types.js";
-8
View File
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});
+2 -2
View File
@@ -19,8 +19,8 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test __tests__/",
"test:ci": "vitest run" "test:ci": "bun test __tests__/"
}, },
"dependencies": { "dependencies": {
"@ocas/core": "^0.1.1", "@ocas/core": "^0.1.1",
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});
@@ -19,8 +19,8 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test __tests__/",
"test:ci": "vitest run" "test:ci": "bun test __tests__/"
}, },
"dependencies": { "dependencies": {
"@ocas/core": "^0.1.1", "@ocas/core": "^0.1.1",
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});
+2 -2
View File
@@ -19,8 +19,8 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test __tests__/",
"test:ci": "vitest run" "test:ci": "bun test __tests__/"
}, },
"dependencies": { "dependencies": {
"@ocas/core": "^0.1.1", "@ocas/core": "^0.1.1",
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});
+3 -5
View File
@@ -6,8 +6,8 @@
"scripts": { "scripts": {
"dev": "bun server.ts", "dev": "bun server.ts",
"build": "vite build", "build": "vite build",
"test": "vitest run", "test": "bun test src/",
"test:ci": "vitest run" "test:ci": "bun test src/"
}, },
"dependencies": { "dependencies": {
"@base-ui/react": "^1.5.0", "@base-ui/react": "^1.5.0",
@@ -33,10 +33,8 @@
"@types/react": "^19.2.14", "@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.2", "@vitejs/plugin-react": "^6.0.2",
"@vitest/ui": "^4.1.7",
"tailwindcss": "^4.2.4", "tailwindcss": "^4.2.4",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"vite": "^8.0.13", "vite": "^8.0.13"
"vitest": "^4.1.7"
} }
} }
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import type { Edge, Node } from "@xyflow/react"; import type { Edge, Node } from "@xyflow/react";
import { describe, expect, it } from "vitest";
import { LayoutLR } from "../index.js"; import { LayoutLR } from "../index.js";
function makeNode(id: string): Node { function makeNode(id: string): Node {
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "bun:test";
import { transIn } from "../trans-in.js"; import { transIn } from "../trans-in.js";
import type { WorkFlowStep } from "../type.js"; import type { WorkFlowStep } from "../type.js";
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "bun:test";
import type { AnyWorkEdge, AnyWorkNode } from "../../type.js"; import type { AnyWorkEdge, AnyWorkNode } from "../../type.js";
import { validate } from "../validate.js"; import { validate } from "../validate.js";
@@ -1,14 +0,0 @@
import path from "node:path";
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
include: ["src/**/__tests__/**/*.test.ts"],
},
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "./src"),
},
},
});
+2 -2
View File
@@ -16,8 +16,8 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test src/__tests__/",
"test:ci": "vitest run" "test:ci": "bun test src/__tests__/"
}, },
"dependencies": { "dependencies": {
"@ocas/core": "^0.1.1", "@ocas/core": "^0.1.1",
@@ -1,4 +1,4 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "bun:test";
import { import {
createThreadIndexEntry, createThreadIndexEntry,
markThreadSuspended, markThreadSuspended,
@@ -1,4 +1,4 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "bun:test";
import type { StartNodePayload, StepRecord, Target } from "../types.js"; import type { StartNodePayload, StepRecord, Target } from "../types.js";
describe("Protocol types for thread/edge location", () => { describe("Protocol types for thread/edge location", () => {
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import { createMemoryStore, putSchema } from "@ocas/core"; import { createMemoryStore, putSchema } from "@ocas/core";
import { describe, expect, test } from "vitest";
import { tryFrontmatterFastPath } from "../src/frontmatter.js"; import { tryFrontmatterFastPath } from "../src/frontmatter.js";
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import { createMemoryStore, putSchema } from "@ocas/core"; import { createMemoryStore, putSchema } from "@ocas/core";
import { describe, expect, test } from "vitest";
import { tryFrontmatterFastPath } from "../src/frontmatter.js"; import { tryFrontmatterFastPath } from "../src/frontmatter.js";
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import type { StepContext } from "@uncaged/workflow-protocol"; import type { StepContext } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { buildContinuationPrompt } from "../src/build-continuation-prompt.js"; import { buildContinuationPrompt } from "../src/build-continuation-prompt.js";
const reviewerStep: StepContext = { const reviewerStep: StepContext = {
@@ -1,4 +1,4 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "bun:test";
import { buildOutputFormatInstruction } from "../src/build-output-format-instruction.js"; import { buildOutputFormatInstruction } from "../src/build-output-format-instruction.js";
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import type { RoleDefinition } from "@uncaged/workflow-protocol"; import type { RoleDefinition } from "@uncaged/workflow-protocol";
import { describe, expect, test } from "vitest";
import { buildRolePrompt } from "../src/build-role-prompt.js"; import { buildRolePrompt } from "../src/build-role-prompt.js";
describe("buildRolePrompt", () => { describe("buildRolePrompt", () => {
@@ -1,4 +1,4 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "bun:test";
// We need to test buildHistory indirectly through buildContext // We need to test buildHistory indirectly through buildContext
// since buildHistory is not exported. For now, we'll test the integration // since buildHistory is not exported. For now, we'll test the integration
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import { createMemoryStore, putSchema } from "@ocas/core"; import { createMemoryStore, putSchema } from "@ocas/core";
import { describe, expect, test } from "vitest";
import { tryFrontmatterFastPath } from "../src/frontmatter.js"; import { tryFrontmatterFastPath } from "../src/frontmatter.js";
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises"; import { mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path"; import { dirname, join } from "node:path";
import type { ThreadId } from "@uncaged/workflow-protocol"; import type { ThreadId } from "@uncaged/workflow-protocol";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { getCachedSessionId, getCachePath, setCachedSessionId } from "../src/session-cache.js"; import { getCachedSessionId, getCachePath, setCachedSessionId } from "../src/session-cache.js";
import { resolveStorageRoot } from "../src/storage.js"; import { resolveStorageRoot } from "../src/storage.js";
+2 -2
View File
@@ -16,8 +16,8 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test __tests__/ src/__tests__/",
"test:ci": "vitest run" "test:ci": "bun test __tests__/ src/__tests__/"
}, },
"dependencies": { "dependencies": {
"@ocas/core": "^0.1.1", "@ocas/core": "^0.1.1",
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, test } from "vitest"; import { afterEach, beforeEach, describe, expect, test } from "bun:test";
describe("parseArgv empty prompt error message", () => { describe("parseArgv empty prompt error message", () => {
let stderrOutput: string; let stderrOutput: string;
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "bun:test";
import type { AgentFrontmatter } from "../src/index.js"; import type { AgentFrontmatter } from "../src/index.js";
import { parseFrontmatterMarkdown, validateFrontmatter } from "../src/index.js"; import { parseFrontmatterMarkdown, validateFrontmatter } from "../src/index.js";
+2 -2
View File
@@ -16,8 +16,8 @@
}, },
"scripts": { "scripts": {
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1", "prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
"test": "vitest run", "test": "bun test __tests__/ src/__tests__/",
"test:ci": "vitest run" "test:ci": "bun test __tests__/ src/__tests__/"
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "bun:test";
import { extractUlidTimestamp, generateUlid } from "../ulid.js"; import { extractUlidTimestamp, generateUlid } from "../ulid.js";
describe("extractUlidTimestamp", () => { describe("extractUlidTimestamp", () => {
-8
View File
@@ -1,8 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["src/__tests__/**/*.test.ts"],
passWithNoTests: true,
},
});