test(terminal): keep renderer bench reports separate
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user