This commit is contained in:
Aiden Cline 2025-12-29 23:29:27 -06:00
commit 83823959e3
2 changed files with 24 additions and 2 deletions

View file

@ -13,14 +13,16 @@ const state = path.join(xdgState!, app)
export namespace Global {
export const Path = {
// Allow override via OPENCODE_TEST_HOME for test isolation
home: process.env.OPENCODE_TEST_HOME || os.homedir(),
get home() {
return process.env.OPENCODE_TEST_HOME || os.homedir()
},
data,
bin: path.join(data, "bin"),
log: path.join(data, "log"),
cache,
config,
state,
} as const
}
}
await Promise.all([

View file

@ -144,3 +144,23 @@ test("discovers global skills from ~/.claude/skills/ directory", async () => {
},
})
})
test("returns empty array when no skills exist", async () => {
await using tmp = await tmpdir({ git: true })
// Override global home to a directory without any skills
const originalHome = process.env.OPENCODE_TEST_HOME
process.env.OPENCODE_TEST_HOME = tmp.path
try {
await Instance.provide({
directory: tmp.path,
fn: async () => {
const skills = await Skill.all()
expect(skills).toEqual([])
},
})
} finally {
process.env.OPENCODE_TEST_HOME = originalHome
}
})