Skip to content

Commit 2da1430

Browse files
only21milclaude
andcommitted
test(scripts): drop the render-metrics spawn mirror and the platform parameter it needed
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3a4d78f commit 2da1430

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

‎scripts/render-metrics.test.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ import * as NodePath from "node:path";
55

66
import { describe, expect, it, vi } from "vite-plus/test";
77

8-
import { vitePlusCommand } from "./check-changed-command.ts";
98
import { nondeterministic, renderComparison, runOnce } from "./render-metrics.ts";
109

1110
const mountReport = { commits: 2, renders: 10, components: { Row: 10 } };
12-
const spawned: Array<[command: string, args: string[]]> = [];
1311

1412
vi.mock("node:child_process", () => ({
1513
spawnSync: (
16-
command: string,
17-
args: string[],
14+
_command: string,
15+
_args: string[],
1816
options: { env: { T3CODE_RENDER_REPORT_DIR: string } },
1917
) => {
20-
spawned.push([command, args]);
2118
NodeFS.writeFileSync(
2219
NodePath.join(options.env.T3CODE_RENDER_REPORT_DIR, "mount.json"),
2320
JSON.stringify(mountReport),
@@ -37,9 +34,6 @@ describe("runOnce", () => {
3734
try {
3835
expect(runOnce()).toEqual({ mount: mountReport });
3936
expect(NodeFS.readdirSync(home)).toEqual([]);
40-
spawned.length = 0;
41-
runOnce("win32");
42-
expect(spawned).toEqual([vitePlusCommand(["test", "run", "--project", "renders"], "win32")]);
4337
} finally {
4438
vi.unstubAllEnvs();
4539
NodeFS.rmSync(home, { recursive: true, force: true });

‎scripts/render-metrics.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,10 @@ export type RenderMetrics = Readonly<Record<string, ScenarioReport>>;
3939

4040
const root = NodePath.resolve(import.meta.dirname, "..");
4141

42-
export function runOnce(
43-
// oxlint-disable-next-line t3code/no-global-process-runtime -- Standalone Node tooling has no Effect runtime; tests pass the platform explicitly.
44-
platform: NodeJS.Platform = process.platform,
45-
): RenderMetrics {
42+
export function runOnce(): RenderMetrics {
4643
const directory = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-renders-"));
4744
try {
48-
const [command, commandArgs] = vitePlusCommand(
49-
["test", "run", "--project", "renders"],
50-
platform,
51-
);
45+
const [command, commandArgs] = vitePlusCommand(["test", "run", "--project", "renders"]);
5246
const result = NodeChildProcess.spawnSync(command, commandArgs, {
5347
cwd: NodePath.join(root, "apps/web"),
5448
env: { ...process.env, T3CODE_RENDER_REPORT_DIR: directory },
@@ -128,7 +122,7 @@ if (import.meta.main) {
128122
const [command, ...args] = process.argv.slice(2);
129123
if (command === "run") {
130124
const runs = Number(option(args, "--runs") ?? 3);
131-
const results = Array.from({ length: runs }, () => runOnce());
125+
const results = Array.from({ length: runs }, runOnce);
132126
const unstable = nondeterministic(results);
133127
if (unstable.length) {
134128
for (const scenario of unstable) {

0 commit comments

Comments
 (0)