deno/tools/combine_test_results.js
David Sherret 0a162aaecc
ci: upload test results as artifacts (#31686)
This will allow us to track slow and flaky tests.
2025-12-22 12:49:29 -05:00

26 lines
745 B
JavaScript

// Copyright 2018-2025 the Deno authors. MIT license.
import { join } from "@std/path";
import { ROOT_PATH } from "./util.js";
const joinTarget = (fileName) => join(ROOT_PATH, "target", fileName);
const filePaths = [
"test_results_integration.json",
"test_results_specs.json",
"test_results_unit.json",
"test_results_unit_node.json",
].map((fileName) => joinTarget(fileName));
const tests = [];
for (const filePath of filePaths) {
try {
tests.push(...JSON.parse(Deno.readTextFileSync(filePath)).tests);
} catch (err) {
if (!(err instanceof Deno.errors.NotFound)) {
throw err;
}
}
}
const combinedFileText = JSON.stringify({ tests });
Deno.writeTextFileSync(joinTarget("test_results.json"), combinedFileText);