From f3144fcacab2e464b85a3d1c4eb4ce8d47e80d38 Mon Sep 17 00:00:00 2001 From: Baker B Date: Tue, 5 May 2026 22:11:14 -0400 Subject: [PATCH] fix(integration-tests): use node: prefix to bypass bun module mocks CI failed with: SyntaxError: Export named 'spawnSync' not found in module 'node:child_process'. Root cause: pr-merge-github.test.ts (and other test files) call mock.module('child_process', ...) which leaks across bun's shared test-runner module space. The mock only exports execSync, so when this integration test imports spawnSync without the node: prefix, it resolves to the partial mock and the import fails. The node: prefix forces explicit Node built-in resolution, bypassing the mock. This is the correct fix per Bun's mocking documentation. --- tests/integration/cli-flag-shapes.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli-flag-shapes.test.ts b/tests/integration/cli-flag-shapes.test.ts index 6c33544..58e522b 100644 --- a/tests/integration/cli-flag-shapes.test.ts +++ b/tests/integration/cli-flag-shapes.test.ts @@ -10,7 +10,11 @@ */ import { describe, test, expect } from 'bun:test'; -import { execSync, spawnSync } from 'child_process'; +// Use the `node:` prefix to bypass bun module mocks. Other test files +// (e.g. pr-merge-github.test.ts) mock 'child_process' to override execSync, +// and that mock leaks across the shared test-runner module space — without +// the prefix, `spawnSync` resolves to the partial mock and is undefined. +import { execSync, spawnSync } from 'node:child_process'; // --- Helper ---------------------------------------------------------------- // `gh` and `glab` may write `--help` output to either stdout or stderr