fix(integration-tests): use node: prefix to bypass bun module mocks#412
Merged
bakeb7j0 merged 1 commit intokahuna/390-bug-drainfrom May 6, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third hotfix attempt for the kahuna→main blocking integration tests. CI failed with:
Root Cause
Other test files (notably
pr-merge-github.test.ts) callmock.module('child_process', () => ({ execSync: mockExecSync })). This mock leaks across bun's shared test-runner module space. The mock only exportsexecSync, so whencli-flag-shapes.test.tsimportsspawnSyncfrom'child_process'(no prefix), it hits the partial mock and the import fails.This explains why local tests passed (test ordering happened to load the integration test before the mock was registered) but CI failed (different test order).
Fix
Use the
node:child_processprefix which forces explicit Node built-in resolution and bypasses bun's module mock layer.Tests