From d40ca0abc29587d5fbeb7cb113324b096766f4e1 Mon Sep 17 00:00:00 2001 From: Victor Adossi Date: Tue, 4 Aug 2026 22:12:21 +0900 Subject: [PATCH] fix(transpile): restore p3 CLI tests on Node 26 --- packages/jco-transpile/test/p3/cli-runner.js | 14 ++++++++++---- packages/jco-transpile/test/p3/helpers/fixtures.js | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/jco-transpile/test/p3/cli-runner.js b/packages/jco-transpile/test/p3/cli-runner.js index e8c4805be..8fa580132 100644 --- a/packages/jco-transpile/test/p3/cli-runner.js +++ b/packages/jco-transpile/test/p3/cli-runner.js @@ -1,11 +1,13 @@ import { argv } from 'node:process'; import { _setPreopens as _setP3Preopens } from '@bytecodealliance/preview3-shim/filesystem'; +import { _forbiddenHeaders } from '@bytecodealliance/preview3-shim/http'; import { _setPreopens as _setP2Preopens } from '@bytecodealliance/preview2-shim/filesystem'; +import { _setArgs as _setP2Args, _setCwd as _setP2Cwd } from '@bytecodealliance/preview2-shim/cli'; import { - _setArgs, - _setCwd, + _setArgs as _setP3Args, + _setCwd as _setP3Cwd, _setTerminalStdin, _setTerminalStdout, _setTerminalStderr, @@ -18,13 +20,17 @@ if (!esModuleHref || !preopenDir || !argsJson) { throw new Error('usage: cli-runner.mjs '); } -_setArgs(JSON.parse(argsJson)); -_setCwd(null); +const args = JSON.parse(argsJson); +_setP2Args(args); +_setP3Args(args); +_setP2Cwd(null); +_setP3Cwd(null); _setTerminalStdin(null); _setTerminalStdout(null); _setTerminalStderr(null); _setP3Preopens({ '/': preopenDir }); _setP2Preopens({ '/': preopenDir }); +_forbiddenHeaders.value.add('custom-forbidden-header'); const esModule = await import(esModuleHref); if (esModule.$init) { diff --git a/packages/jco-transpile/test/p3/helpers/fixtures.js b/packages/jco-transpile/test/p3/helpers/fixtures.js index f3c147038..6d12ef122 100644 --- a/packages/jco-transpile/test/p3/helpers/fixtures.js +++ b/packages/jco-transpile/test/p3/helpers/fixtures.js @@ -15,7 +15,6 @@ export const P3_CLI_RUN_FIXTURES = [ { path: 'cli/p3-cli-much-stdout.wasm', args: ['p3_cli_much_stdout.component', 'hello, world\n', '1'], - failing: process.versions.node.startsWith('26'), }, { path: 'cli/p3-cli.wasm', args: ['p3_cli.component', '.'] }, { path: 'clocks/p3-clocks-sleep.wasm' }, @@ -25,7 +24,7 @@ export const P3_CLI_RUN_FIXTURES = [ { path: 'http/p3-http-outbound-request-content-length.wasm', retry: 3 }, { path: 'http/p3-http-outbound-request-get.wasm' }, { path: 'http/p3-http-outbound-request-invalid-dnsname.wasm' }, - { path: 'http/p3-http-outbound-request-invalid-header.wasm', failing: process.versions.node.startsWith('26') }, + { path: 'http/p3-http-outbound-request-invalid-header.wasm' }, { path: 'http/p3-http-outbound-request-invalid-port.wasm' }, { path: 'http/p3-http-outbound-request-invalid-version.wasm' }, { path: 'http/p3-http-outbound-request-large-post.wasm' },