Skip to content

Commit 78f1b96

Browse files
committed
Extend test for listing skills
Note that the added test is muted
1 parent f799cc8 commit 78f1b96

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

src/__tests__/CodexACPAgent/e2e/acp-e2e.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from "node:path";
12
import {afterEach, expect, it} from "vitest";
23
import {AgentMode} from "../../../AgentMode";
34
import {
@@ -90,7 +91,7 @@ describeE2E("E2E tests", () => {
9091
});
9192
});
9293

93-
it("lists a user skill from the wrapped CODEX_HOME", async () => {
94+
it("lists a user skill from the CODEX_HOME", async () => {
9495
fixture = await createAuthenticatedFixture();
9596
fixture.writeSkill({
9697
name: "integration-skill",
@@ -103,4 +104,28 @@ describeE2E("E2E tests", () => {
103104
expect(text).toContain("- integration-skill: Integration skill");
104105
});
105106
});
107+
108+
// Currently, `additionalRoots` are not propagated when listing skills
109+
it.skip("lists skills from additional session roots", async () => {
110+
fixture = await createAuthenticatedFixture();
111+
const additionalSkillsRoot = path.join(fixture.workspaceDir, "custom-skills");
112+
fixture.writeSkill({
113+
name: "session-root-skill",
114+
description: "Session root skill",
115+
body: "This skill exists only in an additional root passed at session creation.",
116+
}, additionalSkillsRoot);
117+
118+
const session = await fixture.connection.newSession({
119+
cwd: fixture.workspaceDir,
120+
mcpServers: [],
121+
_meta: {
122+
additionalRoots: [additionalSkillsRoot],
123+
},
124+
});
125+
126+
await fixture.expectPromptText(session.sessionId, "/skills", (text) => {
127+
expect(text).toContain("Available skills:");
128+
expect(text).toContain("- session-root-skill: Session root skill");
129+
});
130+
});
106131
});

src/__tests__/CodexACPAgent/e2e/spawned-agent-fixture.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface SpawnedAgentFixture {
2222
readonly workspaceDir: string;
2323
createSession(mcpServers?: acp.McpServer[]): Promise<acp.NewSessionResponse>;
2424
restart(): Promise<SpawnedAgentFixture>;
25-
writeSkill(skill: TestSkill): void;
25+
writeSkill(skill: TestSkill, rootDir?: string): void;
2626
setPermissionResponder(responder: PermissionResponder): void;
2727
expectPromptText(
2828
sessionId: string,
@@ -170,8 +170,9 @@ class SpawnedAgentFixtureImpl implements SpawnedAgentFixture {
170170
return await createSpawnedAgentFixture(this.initializeConnection, this.extraEnv, this.paths);
171171
}
172172

173-
writeSkill(skill: TestSkill): void {
174-
const skillDirectory = path.join(this.paths.codexHome, "skills", skill.name);
173+
writeSkill(skill: TestSkill, rootDir?: string): void {
174+
const skillsRoot = rootDir ?? path.join(this.paths.codexHome, "skills");
175+
const skillDirectory = path.join(skillsRoot, skill.name);
175176
fs.mkdirSync(skillDirectory, {recursive: true});
176177
fs.writeFileSync(
177178
path.join(skillDirectory, "SKILL.md"),

0 commit comments

Comments
 (0)