diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 61ee9f2031..0443bdbc27 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -45,6 +45,10 @@ jobs: ref: ${{ inputs.ref }} persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 + # The stdin regression test spawns Node; exercise the minimum version advertised to users. + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "20.12.0" - run: bun install --frozen-lockfile # Every static check reports even when an earlier one fails. Build and tests only run when all pass. @@ -90,6 +94,10 @@ jobs: ref: ${{ inputs.ref }} persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 + # The stdin regression test spawns Node; exercise the minimum version advertised to users. + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: "20.12.0" - run: bun install --frozen-lockfile - run: bun run build - run: bun pm pack --ignore-scripts diff --git a/src/io/source.test.ts b/src/io/source.test.ts index c29bfa6625..915ce39850 100644 --- a/src/io/source.test.ts +++ b/src/io/source.test.ts @@ -100,17 +100,27 @@ describe("SourceResolver bytes", () => { child.stdout.on("data", (chunk) => { output += chunk; }); - child.stderr.on("data", (chunk) => { - errors += chunk; + const ready = new Promise((resolve, reject) => { + child.stderr.on("data", (chunk) => { + errors += chunk; + if (errors.includes("READY\n")) resolve(); + }); + child.once("close", (code) => { + reject(new Error(`Child exited before READY (${code}):\n${errors}`)); + }); + child.once("error", (error) => { + reject(error); + }); }); - await once(child.stderr, "data"); + await ready; await new Promise((resolve) => setTimeout(resolve, 100)); child.stdin.end("late value"); const [code] = await once(child, "close"); + // Node 20 can warn while importing Ink, before the READY marker. + expect(errors).toContain("READY\n"); expect(code).toBe(0); - expect(errors).toBe("READY\n"); expect(output).toBe("late value"); }, );