CI: remove Vitest JSON report artifacts (#30976)

* CI: remove vitest JSON report upload steps

* Tests: stop injecting vitest JSON reporter

* Tests: remove vitest slowest report script
This commit is contained in:
Vincent Koc
2026-03-01 13:03:06 -08:00
committed by GitHub
parent 79f818e8a2
commit 94a5d28d26
3 changed files with 1 additions and 241 deletions

View File

@@ -1,7 +1,6 @@
import { spawn } from "node:child_process";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
// On Windows, `.cmd` launchers can fail with `spawn EINVAL` when invoked without a shell
// (especially under GitHub Actions + Git Bash). Use `shell: true` and let the shell resolve pnpm.
@@ -313,49 +312,9 @@ const maxOldSpaceSizeMb = (() => {
return null;
})();
function resolveReportDir() {
const raw = process.env.OPENCLAW_VITEST_REPORT_DIR?.trim();
if (!raw) {
return null;
}
try {
fs.mkdirSync(raw, { recursive: true });
} catch {
return null;
}
return raw;
}
function buildReporterArgs(entry, extraArgs) {
const reportDir = resolveReportDir();
if (!reportDir) {
return [];
}
// Vitest supports both `--shard 1/2` and `--shard=1/2`. We use it in the
// split-arg form, so we need to read the next arg to avoid overwriting reports.
const shardIndex = extraArgs.findIndex((arg) => arg === "--shard");
const inlineShardArg = extraArgs.find(
(arg) => typeof arg === "string" && arg.startsWith("--shard="),
);
const shardValue =
shardIndex >= 0 && typeof extraArgs[shardIndex + 1] === "string"
? extraArgs[shardIndex + 1]
: typeof inlineShardArg === "string"
? inlineShardArg.slice("--shard=".length)
: "";
const shardSuffix = shardValue
? `-shard${String(shardValue).replaceAll("/", "of").replaceAll(" ", "")}`
: "";
const outputFile = path.join(reportDir, `vitest-${entry.name}${shardSuffix}.json`);
return ["--reporter=default", "--reporter=json", "--outputFile", outputFile];
}
const runOnce = (entry, extraArgs = []) =>
new Promise((resolve) => {
const maxWorkers = maxWorkersForRun(entry.name);
const reporterArgs = buildReporterArgs(entry, extraArgs);
// vmForks with a single worker has shown cross-file leakage in extension suites.
// Fall back to process forks when we intentionally clamp that lane to one worker.
const entryArgs =
@@ -368,11 +327,10 @@ const runOnce = (entry, extraArgs = []) =>
"--maxWorkers",
String(maxWorkers),
...silentArgs,
...reporterArgs,
...windowsCiArgs,
...extraArgs,
]
: [...entryArgs, ...silentArgs, ...reporterArgs, ...windowsCiArgs, ...extraArgs];
: [...entryArgs, ...silentArgs, ...windowsCiArgs, ...extraArgs];
const nodeOptions = process.env.NODE_OPTIONS ?? "";
const nextNodeOptions = WARNING_SUPPRESSION_FLAGS.reduce(
(acc, flag) => (acc.includes(flag) ? acc : `${acc} ${flag}`.trim()),