Skip to content

Commit 32b4438

Browse files
committed
Extend skills listing test
1 parent a84f9be commit 32b4438

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {execFileSync} from "node:child_process";
2+
import path from "node:path";
13
import {afterEach, expect, it} from "vitest";
24
import {AgentMode} from "../../../AgentMode";
35
import {
@@ -90,17 +92,33 @@ describeE2E("E2E tests", () => {
9092
});
9193
});
9294

93-
it("lists a user skill from the wrapped CODEX_HOME", async () => {
95+
it("lists skills", async () => {
9496
fixture = await createAuthenticatedFixture();
9597
fixture.writeSkill({
96-
name: "integration-skill",
97-
description: "Integration skill",
98+
name: "codex-home-skill",
99+
description: "Codex home skill",
98100
body: "This skill exists only for integration testing.",
99101
});
100-
const session = await fixture.createSession();
102+
103+
const additionalSkillsRoot = path.join(fixture.workspaceDir, "custom-skills");
104+
fixture.writeSkill({
105+
name: "session-root-skill",
106+
description: "Session root skill",
107+
body: "This skill exists only in an additional root passed at session creation.",
108+
}, additionalSkillsRoot);
109+
110+
const session = await fixture.connection.newSession({
111+
cwd: fixture.workspaceDir,
112+
mcpServers: [],
113+
_meta: {
114+
additionalRoots: [additionalSkillsRoot],
115+
},
116+
});
117+
118+
// Expecting skills from CODEX_HOME, workspace, and additional root
101119
await fixture.expectPromptText(session.sessionId, "/skills", (text) => {
102120
expect(text).toContain("Available skills:");
103-
expect(text).toContain("- integration-skill: Integration skill");
121+
expect(text).toContain("- session-root-skill: Session root skill");
104122
});
105123
});
106124
});

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)