11/// <reference types="bun-types" />
22
33import { describe , expect , test } from "bun:test"
4- import { readFileSync } from "node:fs"
54import { join } from "node:path"
65import { fileURLToPath } from "node:url"
76
87const 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
1413describe ( "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