mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 13:09:21 +01:00
a5ce18f9e0
PR-URL: https://github.com/nodejs/node/pull/47635 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
33 lines
915 B
JavaScript
33 lines
915 B
JavaScript
import * as fs from 'node:fs';
|
|
import * as path from 'node:path';
|
|
import * as url from 'node:url';
|
|
|
|
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
|
|
const outDir = path.resolve(__dirname, '../out/wpt');
|
|
const files = fs.readdirSync(outDir);
|
|
const reports = files.filter((file) => file.endsWith('.json'));
|
|
|
|
const startTimes = [];
|
|
const endTimes = [];
|
|
const results = [];
|
|
let runInfo;
|
|
|
|
for (const file of reports) {
|
|
const report = JSON.parse(fs.readFileSync(path.resolve(outDir, file)));
|
|
fs.unlinkSync(path.resolve(outDir, file));
|
|
results.push(...report.results);
|
|
startTimes.push(report.time_start);
|
|
endTimes.push(report.time_end);
|
|
runInfo ||= report.run_info;
|
|
}
|
|
|
|
const mergedReport = {
|
|
time_start: Math.min(...startTimes),
|
|
time_end: Math.max(...endTimes),
|
|
run_info: runInfo,
|
|
results,
|
|
};
|
|
|
|
fs.writeFileSync(path.resolve(outDir, 'wptreport.json'), JSON.stringify(mergedReport));
|