mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
Tests: scope grouped benchmark artifacts
This commit is contained in:
@@ -220,6 +220,17 @@ function readGroupedReport(reportPath) {
|
||||
return JSON.parse(fs.readFileSync(reportPath, "utf8"));
|
||||
}
|
||||
|
||||
export function resolveReportArtifactDirs(outputPath) {
|
||||
const outputDir = path.dirname(outputPath);
|
||||
const outputExt = path.extname(outputPath);
|
||||
const outputStem = path.basename(outputPath, outputExt) || "group-report";
|
||||
const artifactDir = path.join(outputDir, outputStem);
|
||||
return {
|
||||
reportDir: path.join(artifactDir, "vitest-json"),
|
||||
logDir: path.join(artifactDir, "logs"),
|
||||
};
|
||||
}
|
||||
|
||||
function resolveConfigs(args) {
|
||||
if (args.reports.length > 0) {
|
||||
return [];
|
||||
@@ -267,8 +278,7 @@ async function main() {
|
||||
return;
|
||||
}
|
||||
|
||||
const reportDir = path.join(path.dirname(output), "vitest-json");
|
||||
const logDir = path.join(path.dirname(output), "logs");
|
||||
const { reportDir, logDir } = resolveReportArtifactDirs(output);
|
||||
const runEntries = [];
|
||||
const configs = resolveConfigs(args);
|
||||
let failed = false;
|
||||
|
||||
@@ -7,7 +7,10 @@ import {
|
||||
resolveGroupKey,
|
||||
resolveTestArea,
|
||||
} from "../../scripts/lib/test-group-report.mjs";
|
||||
import { parseTestGroupReportArgs } from "../../scripts/test-group-report.mjs";
|
||||
import {
|
||||
parseTestGroupReportArgs,
|
||||
resolveReportArtifactDirs,
|
||||
} from "../../scripts/test-group-report.mjs";
|
||||
|
||||
describe("scripts/test-group-report grouping", () => {
|
||||
it("groups repo files by stable product area", () => {
|
||||
@@ -201,3 +204,12 @@ describe("scripts/test-group-report arg parsing", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("scripts/test-group-report artifact paths", () => {
|
||||
it("keeps raw Vitest reports scoped to the output file stem", () => {
|
||||
expect(resolveReportArtifactDirs(".artifacts/test-perf/baseline-before.json")).toEqual({
|
||||
reportDir: path.join(".artifacts", "test-perf", "baseline-before", "vitest-json"),
|
||||
logDir: path.join(".artifacts", "test-perf", "baseline-before", "logs"),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user