From 89ef4c6b52ee1d722ee3d9f02feccab458dbe114 Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Mon, 2 Jun 2025 15:55:05 -0700 Subject: [PATCH] dont use spawnSync (broken behaviour) --- test/js/third_party/astro/astro-post.test.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/js/third_party/astro/astro-post.test.js b/test/js/third_party/astro/astro-post.test.js index 904fb55398..b323ed9fa5 100644 --- a/test/js/third_party/astro/astro-post.test.js +++ b/test/js/third_party/astro/astro-post.test.js @@ -4,21 +4,22 @@ import { bunEnv, nodeExe } from "harness"; import { join } from "path"; const fixtureDir = join(import.meta.dirname, "fixtures"); -function postNodeFormData(port) { - const result = Bun.spawnSync({ +async function postNodeFormData(port) { + const result = Bun.spawn({ cmd: [nodeExe(), join(fixtureDir, "node-form-data.fetch.fixture.js"), port?.toString()], env: bunEnv, stdio: ["inherit", "inherit", "inherit"], }); - expect(result.exitCode).toBe(0); + expect(await result.exited).toBe(0); } -function postNodeAction(port) { - const result = Bun.spawnSync({ +async function postNodeAction(port) { + const result = Bun.spawn({ cmd: [nodeExe(), join(fixtureDir, "node-action.fetch.fixture.js"), port?.toString()], env: bunEnv, stdio: ["inherit", "inherit", "inherit"], }); - expect(result.exitCode).toBe(0); + + expect(await result.exited).toBe(0); } describe("astro", async () => { @@ -66,7 +67,7 @@ describe("astro", async () => { }); test("is able todo a POST request to an astro action using node", async () => { - postNodeAction(previewServer.port); + await postNodeAction(previewServer.port); }); test("is able to post form data to an astro using bun", async () => { @@ -89,6 +90,6 @@ describe("astro", async () => { }); }); test("is able to post form data to an astro using node", async () => { - postNodeFormData(previewServer.port); + await postNodeFormData(previewServer.port); }); });