Skip to content

Commit fb022a2

Browse files
committed
fix(qa-lab): use junctions for Windows workspace repo links
1 parent 9afc333 commit fb022a2

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

extensions/qa-lab/src/qa-agent-workspace.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
import fs from "node:fs/promises";
33
import path from "node:path";
44
import { afterEach, describe, expect, it } from "vitest";
5-
import { seedQaAgentWorkspace } from "./qa-agent-workspace.js";
5+
import { __testing, seedQaAgentWorkspace } from "./qa-agent-workspace.js";
66
import { createTempDirHarness } from "./temp-dir.test-helper.js";
77

88
const { cleanup, makeTempDir } = createTempDirHarness();
99

1010
afterEach(cleanup);
1111

1212
describe("seedQaAgentWorkspace", () => {
13+
it("uses Windows junctions for the repo link", () => {
14+
expect(__testing.resolveQaAgentWorkspaceRepoLinkType("win32")).toBe("junction");
15+
expect(__testing.resolveQaAgentWorkspaceRepoLinkType("linux")).toBe("dir");
16+
expect(__testing.resolveQaAgentWorkspaceRepoLinkType("darwin")).toBe("dir");
17+
});
18+
1319
it("creates a repo symlink when a repo root is provided", async () => {
1420
const workspaceDir = await makeTempDir("qa-workspace-");
1521
const repoRoot = await makeTempDir("qa-repo-");

extensions/qa-lab/src/qa-agent-workspace.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import {
77
readQaScenarioPackYamlSource,
88
} from "./scenario-catalog.js";
99

10+
function resolveQaAgentWorkspaceRepoLinkType(platform: NodeJS.Platform = process.platform) {
11+
return platform === "win32" ? "junction" : "dir";
12+
}
13+
1014
export async function seedQaAgentWorkspace(params: { workspaceDir: string; repoRoot?: string }) {
1115
const catalog = readQaBootstrapScenarioCatalog();
1216
await fs.mkdir(params.workspaceDir, { recursive: true });
@@ -44,6 +48,12 @@ The mounted repo source should be available read-only under \`./repo/\`.
4448
if (params.repoRoot) {
4549
const repoLinkPath = path.join(params.workspaceDir, "repo");
4650
await fs.rm(repoLinkPath, { force: true, recursive: true });
47-
await fs.symlink(params.repoRoot, repoLinkPath, "dir");
51+
await fs.symlink(params.repoRoot, repoLinkPath, resolveQaAgentWorkspaceRepoLinkType());
4852
}
4953
}
54+
55+
const testing = {
56+
resolveQaAgentWorkspaceRepoLinkType,
57+
};
58+
59+
export { testing as __testing };

0 commit comments

Comments
 (0)