From fe3f0584ed59a4616890992d00ce4e6c1d27dcda Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 16 Mar 2026 11:36:38 +0900 Subject: [PATCH] test(skill-loader): avoid node:fs mock leakage in project skill references Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../project-skill-tool-references.test.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/features/opencode-skill-loader/project-skill-tool-references.test.ts b/src/features/opencode-skill-loader/project-skill-tool-references.test.ts index c417f6c21..ca87d6906 100644 --- a/src/features/opencode-skill-loader/project-skill-tool-references.test.ts +++ b/src/features/opencode-skill-loader/project-skill-tool-references.test.ts @@ -1,20 +1,19 @@ /// import { describe, expect, test } from "bun:test" -import { readFileSync } from "node:fs" import { join } from "node:path" import { fileURLToPath } from "node:url" const PROJECT_ROOT = fileURLToPath(new URL("../../..", import.meta.url)) -function readProjectSkill(...segments: string[]) { - return readFileSync(join(PROJECT_ROOT, ".opencode", "skills", ...segments, "SKILL.md"), "utf8") +async function readProjectSkill(...segments: string[]) { + return Bun.file(join(PROJECT_ROOT, ".opencode", "skills", ...segments, "SKILL.md")).text() } describe("project skill tool references", () => { describe("#given work-with-pr skill instructions", () => { - test("#when reading the commit delegation example #then it uses a real task category", () => { - const skillContent = readProjectSkill("work-with-pr") + test("#when reading the commit delegation example #then it uses a real task category", async () => { + const skillContent = await readProjectSkill("work-with-pr") const usesQuickCategory = skillContent.includes( 'task(category="quick", load_skills=["git-master"], prompt="Commit the changes atomically following git-master conventions. Repository is at {WORKTREE_PATH}.")' @@ -26,8 +25,8 @@ describe("project skill tool references", () => { }) describe("#given github-triage skill instructions", () => { - test("#when reading task tracking examples #then they use the real task management tool names", () => { - const skillContent = readProjectSkill("github-triage") + test("#when reading task tracking examples #then they use the real task management tool names", async () => { + const skillContent = await readProjectSkill("github-triage") const usesRealToolNames = skillContent.includes("task_create(subject=\"Triage: #{number} {title}\")")