fix(qa-lab): use junctions for Windows workspace repo links · openclaw/openclaw@fb022a2
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,14 +2,20 @@
|
2 | 2 | import fs from "node:fs/promises"; |
3 | 3 | import path from "node:path"; |
4 | 4 | import { afterEach, describe, expect, it } from "vitest"; |
5 | | -import { seedQaAgentWorkspace } from "./qa-agent-workspace.js"; |
| 5 | +import { __testing, seedQaAgentWorkspace } from "./qa-agent-workspace.js"; |
6 | 6 | import { createTempDirHarness } from "./temp-dir.test-helper.js"; |
7 | 7 | |
8 | 8 | const { cleanup, makeTempDir } = createTempDirHarness(); |
9 | 9 | |
10 | 10 | afterEach(cleanup); |
11 | 11 | |
12 | 12 | 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 | + |
13 | 19 | it("creates a repo symlink when a repo root is provided", async () => { |
14 | 20 | const workspaceDir = await makeTempDir("qa-workspace-"); |
15 | 21 | const repoRoot = await makeTempDir("qa-repo-"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,6 +7,10 @@ import {
|
7 | 7 | readQaScenarioPackYamlSource, |
8 | 8 | } from "./scenario-catalog.js"; |
9 | 9 | |
| 10 | +function resolveQaAgentWorkspaceRepoLinkType(platform: NodeJS.Platform = process.platform) { |
| 11 | +return platform === "win32" ? "junction" : "dir"; |
| 12 | +} |
| 13 | + |
10 | 14 | export async function seedQaAgentWorkspace(params: { workspaceDir: string; repoRoot?: string }) { |
11 | 15 | const catalog = readQaBootstrapScenarioCatalog(); |
12 | 16 | await fs.mkdir(params.workspaceDir, { recursive: true }); |
@@ -44,6 +48,12 @@ The mounted repo source should be available read-only under \`./repo/\`.
|
44 | 48 | if (params.repoRoot) { |
45 | 49 | const repoLinkPath = path.join(params.workspaceDir, "repo"); |
46 | 50 | await fs.rm(repoLinkPath, { force: true, recursive: true }); |
47 | | -await fs.symlink(params.repoRoot, repoLinkPath, "dir"); |
| 51 | +await fs.symlink(params.repoRoot, repoLinkPath, resolveQaAgentWorkspaceRepoLinkType()); |
48 | 52 | } |
49 | 53 | } |
| 54 | + |
| 55 | +const testing = { |
| 56 | + resolveQaAgentWorkspaceRepoLinkType, |
| 57 | +}; |
| 58 | + |
| 59 | +export { testing as __testing }; |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。