tinyrelayfile
tinyrelay/scripts/conformance/run.mjs/

scripts/conformance/run.mjs raw
1#!/usr/bin/env node
2import { spawnSync } from "node:child_process";
3import { mkdirSync, writeFileSync } from "node:fs";
4import { resolve } from "node:path";
5
6const root = resolve(import.meta.dirname, "../..");
7const stamp = new Date().toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
8const artifactDir = resolve(process.env.CONFORMANCE_ARTIFACTS ?? resolve(root, "artifacts/conformance"), stamp);
9mkdirSync(artifactDir, { recursive: true });
10const env = { ...process.env, RELAY_URL: process.env.RELAY_URL ?? "ws://127.0.0.1:7447" };
11writeFileSync(resolve(artifactDir, "environment.txt"), Object.entries({ RELAY_URL: env.RELAY_URL, NODE: process.version, PLATFORM: process.platform, ARCH: process.arch }).map(([key, value]) => `${key}=${value}`).join("\n") + "\n");
12const result = spawnSync(process.execPath, [resolve(root, "node_modules/vitest/vitest.mjs"), "run", "--config", resolve(root, "scripts/conformance/vitest.config.mts"), ...process.argv.slice(2)], { cwd: root, env, encoding: "utf8", stdio: ["inherit", "pipe", "pipe"] });
13process.stdout.write(result.stdout ?? "");
14process.stderr.write(result.stderr ?? "");
15writeFileSync(resolve(artifactDir, "stdout.log"), result.stdout ?? "");
16writeFileSync(resolve(artifactDir, "stderr.log"), result.stderr ?? "");
17writeFileSync(resolve(artifactDir, "status"), `${result.status ?? 1}\n`);
18console.error(`conformance artifacts: ${artifactDir}`);
19process.exit(result.status ?? 1);

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs