Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/jco-transpile/test/p3/cli-runner.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -18,13 +20,17 @@ if (!esModuleHref || !preopenDir || !argsJson) {
throw new Error('usage: cli-runner.mjs <esModuleHref> <preopenDir> <argsJson>');
}

_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) {
Expand Down
3 changes: 1 addition & 2 deletions packages/jco-transpile/test/p3/helpers/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand All @@ -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' },
Expand Down
Loading