

























11// Qa Matrix tests cover cli plugin behavior.
2-import { mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
2+import { mkdir, mkdtemp, readFile, rm, symlink } from "node:fs/promises";
33import os from "node:os";
44import path from "node:path";
55import { afterEach, describe, expect, it, vi } from "vitest";
@@ -123,6 +123,28 @@ describe("matrix qa cli runtime", () => {
123123await expectPathMissing(outputPath);
124124});
125125126+it.runIf(process.platform !== "win32")(
127+"rejects output dirs that traverse repo-local symlinks",
128+async () => {
129+const repoRoot = await mkdtemp(path.join(os.tmpdir(), "matrix-qa-cli-"));
130+const externalOutputRoot = await mkdtemp(path.join(os.tmpdir(), "matrix-qa-external-"));
131+tmpDirs.push(repoRoot, externalOutputRoot);
132+await mkdir(path.join(repoRoot, ".artifacts"), { recursive: true });
133+await symlink(externalOutputRoot, path.join(repoRoot, ".artifacts", "qa-e2e"));
134+135+await expect(
136+runQaMatrixCommand({
137+ repoRoot,
138+outputDir: ".artifacts/qa-e2e/matrix",
139+providerMode: "mock-openai",
140+credentialSource: "env",
141+}),
142+).rejects.toThrow("Matrix QA output dir must not traverse symlinks.");
143+144+expect(runMatrixQaLive).not.toHaveBeenCalled();
145+},
146+);
147+126148it("preserves the Matrix QA failure when output log cleanup also fails", async () => {
127149const repoRoot = await mkdtemp(path.join(os.tmpdir(), "matrix-qa-cli-"));
128150tmpDirs.push(repoRoot);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。