19 lines
444 B
TypeScript
19 lines
444 B
TypeScript
import type { Result } from "@/lib/types";
|
|
|
|
export default function toCSV(
|
|
headers: string[],
|
|
rows: { date: string; runs: Result[] }
|
|
) {
|
|
const a = rows.runs.flatMap((run) =>
|
|
run.children.map((child) => [
|
|
run.run_name,
|
|
child.test_name,
|
|
child.path,
|
|
child.status,
|
|
child.totalseconds,
|
|
child.percentage_of_total,
|
|
])
|
|
);
|
|
|
|
return [headers.join(","), ...a.map((row) => row.join(","))].join("\n");
|
|
}
|