silent cf test

This commit is contained in:
Pooya Parsa
2024-08-16 02:21:54 +02:00
parent 1f230ba45c
commit eb07007b81
2 changed files with 8 additions and 5 deletions

View File

@@ -138,7 +138,7 @@ class WebSocketInspector extends Agent {
export function wsTestsExec( export function wsTestsExec(
cmd: string, cmd: string,
opts: Parameters<typeof wsTests>[1], opts: Parameters<typeof wsTests>[1] & { silent?: boolean },
tests = wsTests, tests = wsTests,
) { ) {
let childProc: ExecaRes; let childProc: ExecaRes;
@@ -156,9 +156,12 @@ export function wsTestsExec(
console.error(error); console.error(error);
} }
}); });
if (process.env.TEST_DEBUG || !opts.silent) {
console.log("hooking stderr");
childProc.stderr!.on("data", (chunk) => { childProc.stderr!.on("data", (chunk) => {
console.log(chunk.toString()); console.log(chunk.toString());
}); });
}
if (process.env.TEST_DEBUG) { if (process.env.TEST_DEBUG) {
childProc.stdout!.on("data", (chunk) => { childProc.stdout!.on("data", (chunk) => {
console.log(chunk.toString()); console.log(chunk.toString());

View File

@@ -4,6 +4,6 @@ import { wsTestsExec } from "../_utils";
describe("cloudflare", () => { describe("cloudflare", () => {
wsTestsExec( wsTestsExec(
"wrangler dev -c ./wrangler.toml --inspector-port 0 --port $PORT", "wrangler dev -c ./wrangler.toml --inspector-port 0 --port $PORT",
{ adapter: "cloudflare", pubsub: false }, { adapter: "cloudflare", pubsub: false, silent: true },
); );
}); });