mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:40:43 +00:00
fix(matrix): clarify QA CLI artifact directory
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
formatMatrixQaCliCommand,
|
||||
@@ -36,7 +36,7 @@ describe("Matrix QA CLI runtime", () => {
|
||||
});
|
||||
|
||||
it("prefers the ESM OpenClaw CLI entrypoint when present", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "matrix-qa-cli-entry-"));
|
||||
const root = await mkdtemp(path.join(resolvePreferredOpenClawTmpDir(), "matrix-qa-cli-entry-"));
|
||||
try {
|
||||
await mkdir(path.join(root, "dist"));
|
||||
await writeFile(path.join(root, "dist", "index.mjs"), "");
|
||||
@@ -47,7 +47,9 @@ describe("Matrix QA CLI runtime", () => {
|
||||
});
|
||||
|
||||
it("can preserve expected non-zero CLI output for negative scenarios", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "matrix-qa-cli-nonzero-"));
|
||||
const root = await mkdtemp(
|
||||
path.join(resolvePreferredOpenClawTmpDir(), "matrix-qa-cli-nonzero-"),
|
||||
);
|
||||
try {
|
||||
await mkdir(path.join(root, "dist"));
|
||||
await writeFile(
|
||||
|
||||
@@ -320,11 +320,11 @@ export async function createMatrixQaOpenClawCliRuntime(params: {
|
||||
OPENCLAW_STATE_DIR: stateDir,
|
||||
};
|
||||
return {
|
||||
artifactDir,
|
||||
configPath,
|
||||
dispose: async () => {
|
||||
await rm(rootDir, { force: true, recursive: true });
|
||||
},
|
||||
rootDir: artifactDir,
|
||||
run: async (
|
||||
args: string[],
|
||||
opts: { allowNonZero?: boolean; timeoutMs: number },
|
||||
|
||||
@@ -286,10 +286,10 @@ async function writeMatrixQaCliArtifacts(params: {
|
||||
result: MatrixQaCliRunResult;
|
||||
runtime: MatrixQaCliRuntime;
|
||||
}) {
|
||||
await mkdir(params.runtime.rootDir, { mode: 0o700, recursive: true });
|
||||
await mkdir(params.runtime.artifactDir, { mode: 0o700, recursive: true });
|
||||
const safe = params.label.replace(/[^A-Za-z0-9_-]/g, "-");
|
||||
const stdoutPath = path.join(params.runtime.rootDir, `${safe}.stdout.txt`);
|
||||
const stderrPath = path.join(params.runtime.rootDir, `${safe}.stderr.txt`);
|
||||
const stdoutPath = path.join(params.runtime.artifactDir, `${safe}.stdout.txt`);
|
||||
const stderrPath = path.join(params.runtime.artifactDir, `${safe}.stderr.txt`);
|
||||
await Promise.all([
|
||||
writeFile(stdoutPath, redactMatrixQaCliOutput(params.result.stdout), { mode: 0o600 }),
|
||||
writeFile(stderrPath, redactMatrixQaCliOutput(params.result.stderr), { mode: 0o600 }),
|
||||
|
||||
Reference in New Issue
Block a user