Skip to content

Commit fe3f058

Browse files
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 <[email protected]>
1 parent 1cfc1c8 commit fe3f058

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/features/opencode-skill-loader/project-skill-tool-references.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
/// <reference types="bun-types" />
22

33
import { describe, expect, test } from "bun:test"
4-
import { readFileSync } from "node:fs"
54
import { join } from "node:path"
65
import { fileURLToPath } from "node:url"
76

87
const PROJECT_ROOT = fileURLToPath(new URL("../../..", import.meta.url))
98

10-
function readProjectSkill(...segments: string[]) {
11-
return readFileSync(join(PROJECT_ROOT, ".opencode", "skills", ...segments, "SKILL.md"), "utf8")
9+
async function readProjectSkill(...segments: string[]) {
10+
return Bun.file(join(PROJECT_ROOT, ".opencode", "skills", ...segments, "SKILL.md")).text()
1211
}
1312

1413
describe("project skill tool references", () => {
1514
describe("#given work-with-pr skill instructions", () => {
16-
test("#when reading the commit delegation example #then it uses a real task category", () => {
17-
const skillContent = readProjectSkill("work-with-pr")
15+
test("#when reading the commit delegation example #then it uses a real task category", async () => {
16+
const skillContent = await readProjectSkill("work-with-pr")
1817

1918
const usesQuickCategory = skillContent.includes(
2019
'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", () => {
2625
})
2726

2827
describe("#given github-triage skill instructions", () => {
29-
test("#when reading task tracking examples #then they use the real task management tool names", () => {
30-
const skillContent = readProjectSkill("github-triage")
28+
test("#when reading task tracking examples #then they use the real task management tool names", async () => {
29+
const skillContent = await readProjectSkill("github-triage")
3130

3231
const usesRealToolNames =
3332
skillContent.includes("task_create(subject=\"Triage: #{number} {title}\")")

0 commit comments

Comments
 (0)