mirror of
https://github.com/penpot/penpot.git
synced 2026-05-23 08:53:39 +00:00
Introduces `pnpm run test:quiet` for non-interactive runs (CI, scripted invocations, agent loops). It runs the same pipeline as `pnpm run test` — `build:wasm`, then `build:test`, then `node target/tests/test.js` — but buffers each build step's stdout and stderr and only replays them when that step exits non-zero. Test-runner output streams through unchanged, so failures and the summary are never hidden. Short progress hints (`Building wasm...`, `Building test bundle...`, `Running tests...`) are written to stderr, leaving stdout to carry only the test results for clean capture and parsing. Forwards arguments verbatim, so `pnpm run test:quiet -- --focus ...` composes with the existing `--focus` flag. The default `pnpm run test` script and its output are unchanged. Also documents the new command in the developer guide and updates the frontend testing memory to recommend it for agent runs.
31 lines
910 B
JavaScript
31 lines
910 B
JavaScript
import { spawnSync } from "node:child_process";
|
|
|
|
const BUILD_STEPS = [
|
|
{ label: "Building wasm", cmd: "pnpm", args: ["run", "build:wasm"] },
|
|
{ label: "Building test bundle", cmd: "pnpm", args: ["run", "build:test"] },
|
|
];
|
|
|
|
const progress = (msg) => process.stderr.write(`${msg}\n`);
|
|
|
|
for (const step of BUILD_STEPS) {
|
|
progress(`${step.label}...`);
|
|
const result = spawnSync(step.cmd, step.args, {
|
|
stdio: ["ignore", "pipe", "pipe"],
|
|
maxBuffer: 64 * 1024 * 1024,
|
|
});
|
|
if (result.status !== 0) {
|
|
progress(`${step.label} failed`);
|
|
if (result.stdout?.length) process.stdout.write(result.stdout);
|
|
if (result.stderr?.length) process.stderr.write(result.stderr);
|
|
process.exit(result.status ?? 1);
|
|
}
|
|
}
|
|
|
|
progress("Running tests...");
|
|
const result = spawnSync(
|
|
"node",
|
|
["target/tests/test.js", ...process.argv.slice(2)],
|
|
{ stdio: "inherit" },
|
|
);
|
|
process.exit(result.status ?? 1);
|