From b75419b61e2e11760993b3e60046633e2532cbc4 Mon Sep 17 00:00:00 2001 From: RRFZ <247457381+Plastic-time@users.noreply.github.com> Date: Wed, 28 Oct 2026 14:42:21 -0400 Subject: [PATCH] test(firmware): keep producer fixtures within supported Node limits (#7048) * test(firmware): bound fixture hashing and avoid Node startup warnings * test(firmware): apply the Wasm flag only on Node 22 --- tests/fixtures/firmware/producer.mjs | 22 +++++++++++++++++++--- tests/fixtures/firmware/provider.ts | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/firmware/producer.mjs b/tests/fixtures/firmware/producer.mjs index 511e29747c..ef013ec8bf 100644 --- a/tests/fixtures/firmware/producer.mjs +++ b/tests/fixtures/firmware/producer.mjs @@ -1,8 +1,8 @@ import { createHash } from "node:crypto"; -import { createReadStream } from "node:fs"; import { chmod, mkdir, + open, readFile, truncate, writeFile, @@ -146,8 +146,24 @@ if (args.includes("--version")) { const oversized = 128 * 1024 * 1024 + 1; await truncate(child, oversized); const oversizedDigest = createHash("sha256"); - for await (const chunk of createReadStream(child)) - oversizedDigest.update(chunk); + // Reuse one buffer under the real engine's address-space ceiling instead + // of depending on when Node collects the stream's retired chunk buffers. + const source = await open(child, "r"); + try { + const buffer = Buffer.alloc(64 * 1024); + for (;;) { + const { bytesRead } = await source.read( + buffer, + 0, + buffer.length, + null, + ); + if (bytesRead === 0) break; + oversizedDigest.update(buffer.subarray(0, bytesRead)); + } + } finally { + await source.close(); + } const oversizedHash = oversizedDigest.digest("hex"); const nestedUnknownRecords = [ { diff --git a/tests/fixtures/firmware/provider.ts b/tests/fixtures/firmware/provider.ts index 82b23170ea..8756d59600 100644 --- a/tests/fixtures/firmware/provider.ts +++ b/tests/fixtures/firmware/provider.ts @@ -22,6 +22,9 @@ export const firmwareFixture = async (mode = "normal", banner?: string) => { process.execPath, // Keep the synthetic JS producer within the real engines' address-space ceiling. "--jitless", + // Node 22 warns when jitless implicitly disables Wasm. Newer releases do + // not need this flag, and Node 26 no longer accepts it. + ...(process.versions.node.startsWith("22.") ? ["--no-expose-wasm"] : []), fileURLToPath(new URL("./producer.mjs", import.meta.url)), engine, ]