Skip to content

test: isolate bundle builds from the Bun test runner - #452

Merged
EyJunge1 merged 2 commits into
tickernelz:mainfrom
Phototonic:codex/fix-bundle-boundary-test
Oct 28, 2026
Merged

EyJunge1 merged 2 commits into
tickernelz:mainfrom
Phototonic:codex/fix-bundle-boundary-test

Conversation

@Phototonic

Copy link
Copy Markdown
Contributor

Summary

On Bun 1.3.14, the first Bun.build in tests/plugin-bundle-boundary.test.ts fails to resolve existing relative imports such as ../services/logger.js. The following identical build succeeds; selecting the SDK test alone makes that test fail instead. Identical standalone API and CLI builds pass on the same generated files and dependencies.

This matches Bun's test-runner resolver-cache issue, with the directory-cache behavior described in oven-sh/bun#36245. Isolate bundle construction in a fresh process using the current Bun executable, a repository-root working directory, and the same --target=bun --packages=bundle settings.

The change is confined to the test file. Every existing transformer, SDK/OIDC, and bundled provider-loader assertion is retained, and build failures include stderr diagnostics. This preserves the bootstrap guards established by #82 and #165 without changing runtime imports, dependencies, or Bun versions.

Test plan

  • Exercised the change locally (or N/A for docs/meta-only)
  • Noted any follow-up or known limitations

Validated on Linux with Bun 1.3.14, based on upstream 83c386bc6b048220a2e7d9309733e1acd6c608cb:

  • Before: bun test tests/plugin-bundle-boundary.test.ts → 2 passed, 1 failed, with the unresolved-import errors above.
  • After: the same command → 3 passed, 0 failed, including runtime loading of the bundled lazy provider.
  • Negative checks against temporary generated-output mutations: a missing import fails with the build diagnostic; eager SDK and transformer imports each fail their existing bundle-content assertion. Restored the generated output and reran the normal tests successfully.
  • bun run build, bun run typecheck, and bun run check → passed.
  • Full post-build bun test → 949 passed, 4 skipped, 0 failed across 131 files.
  • git diff --check → passed.

Windows and macOS have not been validated locally. No README update is needed for this internal test-isolation change.

Checklist

  • Branch is based on main (do not open PRs from commits already on main)
  • bun test passes (or N/A)
  • bun run typecheck passes (or N/A)
  • bun run check passes (format + lint + typecheck; or N/A)
  • Docs / README updated when behavior or contribution process changes

Phototonic and others added 2 commits October 28, 2026 17:38
Read the CLI bundle from a temp --outfile instead of stdout, pipe stdio explicitly, reject empty output, and cache per entrypoint so the two plugin.js assertions share one subprocess build.
@EyJunge1
EyJunge1 merged commit feadeba into tickernelz:main Oct 28, 2026
2 checks passed
@EyJunge1 EyJunge1 mentioned this pull request Oct 28, 2026
7 tasks done
@Phototonic
Phototonic deleted the codex/fix-bundle-boundary-test branch October 28, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants