From a145a19636d814b3c49f64d08e06756cbfb4382c Mon Sep 17 00:00:00 2001 From: zhangheng Date: Wed, 24 Jun 2026 16:00:32 +0800 Subject: [PATCH] test(terminal): keep renderer bench reports separate --- README.md | 7 +++++-- scripts/terminal-bench.mjs | 13 +++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6e98a83..fecaeea 100644 --- a/README.md +++ b/README.md @@ -44,5 +44,8 @@ Compare renderer modes with: npm run terminal:bench -- --url http://127.0.0.1:3100/rustui/terminal --renderer canvas --browser-executable /usr/bin/google-chrome ``` -It writes `target/terminal-bench/terminal-bench.json` plus screenshots when -Playwright is available in the workspace. +It writes renderer-specific reports such as +`target/terminal-bench/terminal-bench-webgl.json` and +`target/terminal-bench/terminal-bench-canvas.json`, plus +`target/terminal-bench/terminal-bench-latest.json` for the most recent run. +Screenshots are also named by renderer and viewport. diff --git a/scripts/terminal-bench.mjs b/scripts/terminal-bench.mjs index e35264a..4c8ef99 100644 --- a/scripts/terminal-bench.mjs +++ b/scripts/terminal-bench.mjs @@ -157,8 +157,13 @@ async function main() { } const report = buildReport(results); - const reportPath = path.join(options.outputDir, "terminal-bench.json"); - fs.writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`); + const reportJson = `${JSON.stringify(report, null, 2)}\n`; + const reportPath = terminalBenchReportPath(options); + const latestReportPath = path.join(options.outputDir, "terminal-bench-latest.json"); + fs.writeFileSync(reportPath, reportJson); + fs.writeFileSync(latestReportPath, reportJson); + console.error(`[terminal-bench] wrote ${reportPath}`); + console.error(`[terminal-bench] wrote ${latestReportPath}`); console.log(JSON.stringify(report, null, 2)); if (!report.passed) { process.exitCode = 1; @@ -289,6 +294,10 @@ function benchUrl(options) { return url.toString(); } +function terminalBenchReportPath(options) { + return path.join(options.outputDir, `terminal-bench-${options.renderer}.json`); +} + function browserLaunchOptions(options) { if (options.browserChannel) { return { channel: options.browserChannel };