




















@@ -1,10 +1,17 @@
1-import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
1+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
22import type { WorkspaceBootstrapFile } from "./workspace.js";
3344vi.mock("./workspace.js", () => ({
55loadWorkspaceBootstrapFiles: vi.fn(),
66}));
778+import {
9+clearAllBootstrapSnapshots,
10+clearBootstrapSnapshot,
11+getOrLoadBootstrapFiles,
12+} from "./bootstrap-cache.js";
13+import { loadWorkspaceBootstrapFiles } from "./workspace.js";
14+815function makeFile(name: string, content: string): WorkspaceBootstrapFile {
916return {
1017name: name as WorkspaceBootstrapFile["name"],
@@ -16,17 +23,7 @@ function makeFile(name: string, content: string): WorkspaceBootstrapFile {
16231724describe("getOrLoadBootstrapFiles", () => {
1825const files = [makeFile("AGENTS.md", "# Agent"), makeFile("SOUL.md", "# Soul")];
19-let clearAllBootstrapSnapshots: typeof import("./bootstrap-cache.js").clearAllBootstrapSnapshots;
20-let getOrLoadBootstrapFiles: typeof import("./bootstrap-cache.js").getOrLoadBootstrapFiles;
21-let workspaceModule: typeof import("./workspace.js");
22-23-const mockLoad = () => vi.mocked(workspaceModule.loadWorkspaceBootstrapFiles);
24-25-beforeAll(async () => {
26-({ clearAllBootstrapSnapshots, getOrLoadBootstrapFiles } =
27-await import("./bootstrap-cache.js"));
28-workspaceModule = await import("./workspace.js");
29-});
26+const mockLoad = () => vi.mocked(loadWorkspaceBootstrapFiles);
30273128beforeEach(() => {
3229clearAllBootstrapSnapshots();
@@ -87,18 +84,7 @@ describe("getOrLoadBootstrapFiles", () => {
8784});
88858986describe("clearBootstrapSnapshot", () => {
90-let clearAllBootstrapSnapshots: typeof import("./bootstrap-cache.js").clearAllBootstrapSnapshots;
91-let clearBootstrapSnapshot: typeof import("./bootstrap-cache.js").clearBootstrapSnapshot;
92-let getOrLoadBootstrapFiles: typeof import("./bootstrap-cache.js").getOrLoadBootstrapFiles;
93-let workspaceModule: typeof import("./workspace.js");
94-95-const mockLoad = () => vi.mocked(workspaceModule.loadWorkspaceBootstrapFiles);
96-97-beforeAll(async () => {
98-({ clearAllBootstrapSnapshots, clearBootstrapSnapshot, getOrLoadBootstrapFiles } =
99-await import("./bootstrap-cache.js"));
100-workspaceModule = await import("./workspace.js");
101-});
87+const mockLoad = () => vi.mocked(loadWorkspaceBootstrapFiles);
1028810389beforeEach(() => {
10490clearAllBootstrapSnapshots();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。