From a1b961ded11227fab9b26f524e55fed9747f6442 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 4 Nov 2026 12:42:58 +0800 Subject: [PATCH] test(cloudflare): let the Docker stub read the Dockerfile from stdin The Container dev server test stubs Docker with a script that exits at once. The Cloudflare Vite plugin writes the Dockerfile to `docker build -f -` on stdin, so when the stub exits before that write, the write fails with an uncaught EPIPE and fails the test run. The stub now reads stdin for `build`, so it cannot exit first. Co-Authored-By: Claude Opus 5.5 --- packages/void/test/unit/plugin-cloudflare-v2.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/void/test/unit/plugin-cloudflare-v2.test.ts b/packages/void/test/unit/plugin-cloudflare-v2.test.ts index c3ad7bf35..24209f596 100644 --- a/packages/void/test/unit/plugin-cloudflare-v2.test.ts +++ b/packages/void/test/unit/plugin-cloudflare-v2.test.ts @@ -199,8 +199,12 @@ export default { writeFileSync(join(root, 'Dockerfile'), 'FROM scratch\n'); // The dev server prepares images at startup but starts no Container until one is // used, so a stub lets this test run the real plugin and Miniflare without Docker. + // `docker build -f -` receives the Dockerfile on stdin. The stub reads it, because + // a stub that exits first makes that write fail with an uncaught EPIPE. const docker = join(root, 'docker-stub'); - writeFileSync(docker, '#!/bin/sh\nexit 0\n', { mode: 0o755 }); + writeFileSync(docker, '#!/bin/sh\nif [ "$1" = build ]; then cat >/dev/null; fi\nexit 0\n', { + mode: 0o755, + }); vi.stubEnv('WRANGLER_DOCKER_BIN', docker); const plugins = () => cloudflare({