import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import { createTestSession, type TestSession } from "../../../test/harness"; describe("mockup pi-test-harness", () => { let t: TestSession | undefined; afterEach(() => { t?.dispose(); t = undefined; }); it("loads the tool and its on-demand guidance in the real Pi runtime", async () => { const extensionPath = path.resolve(import.meta.dirname, "../index.ts"); t = await createTestSession({ extensions: [extensionPath] }); expect(t.session.extensionRunner.extensions).toHaveLength(1); expect(t.session.extensionRunner.extensions[0].path).toBe(extensionPath); expect(t.session.getActiveToolNames()).toContain("mockup"); const guidancePath = path.resolve( import.meta.dirname, "../guidance/mockup-html/SKILL.md", ); expect(t.session.systemPrompt).toContain( `Before creating or revising mockups, read \`${guidancePath}\`.`, ); expect( t.session.resourceLoader .getSkills() .skills.some((skill) => skill.name === "mockup-html"), ).toBe(false); expect(t.session.systemPrompt).not.toContain( "Rich interactions, scripts, and animations are allowed", ); }); });