penpot/exporter/scripts/test-quiet.js
Andrey Antukh 676701f74c ✨ Move the exports to the queue worker
The exporter becomes a durable-job worker: the shared item and params
contract, the creation command (mixed scope rejected, single-use runs
marked transient), the external job-def, and the worker that consumes
the `:exporter` queue with one management client, serialized beats,
multipart settle and share-aware asset fetches.

The server side it needs lands here too: per-tenant `exporter:<tenant>`
key ids derived from the same secret (the bare legacy id keeps serving
the deployment own tenant), a heartbeat that filters by tenant in its
own write, and the management API with session mint and settle scoped to
the job owner. The artifact upload is multipart-only and confined to the
parser temp areas.

The frontend follows the job on the websocket: milestones, artifact
download and cancel by job id, with the payload validated against the
contract by a test per caller. nginx, devenv and the docs drop the old
exporter endpoint.

AI-assisted-by: deepseek-v4.1-flash
2026-11-04 17:20:22 +00:00

37 lines
1.1 KiB
JavaScript

import { spawnSync } from "node:child_process";
const BUILD_STEPS = [
{ 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",
// the config of the process needs a secret to even boot: same
// default the `test` script uses when the environment says nothing
env: {
...process.env,
PENPOT_SECRET_KEY: process.env.PENPOT_SECRET_KEY || "test-secret-key",
},
});
process.exit(result.status ?? 1);