Skip to content

Add Bun runtime support and fix CustomResponse export#650

Open
jancurn wants to merge 2 commits intomasterfrom
claude/add-bun-support-529IW
Open

Add Bun runtime support and fix CustomResponse export#650
jancurn wants to merge 2 commits intomasterfrom
claude/add-bun-support-529IW

Conversation

@jancurn
Copy link
Copy Markdown
Member

@jancurn jancurn commented Apr 22, 2026

Summary

This PR adds support for running tests with Bun as an alternative JavaScript runtime, while also fixing a TypeScript export issue in the main library code.

Key Changes

  • Bun Runtime Support: Added a new test:bun npm script that runs tests using Bun instead of Node.js
  • CI/CD Integration: Added a new bun_test job to the GitHub Actions workflow that:
    • Sets up Node.js 18 and installs Bun
    • Runs the test suite using the new test:bun script
    • Includes the necessary localhost-test hosts file configuration
  • Documentation: Updated test README with instructions for running tests with Bun
  • TypeScript Export Fix: Changed CustomResponse export from a value export to a type-only export in src/index.ts to prevent runtime issues and improve tree-shaking

Implementation Details

  • The Bun test job respects the [skip ci] commit message flag, consistent with existing CI jobs
  • Uses bun --bun run mocha to execute tests with Bun's runtime
  • The type-only export change ensures CustomResponse is only available at compile-time, not runtime, which is the correct pattern for TypeScript type definitions

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4

claude added 2 commits April 22, 2026 13:11
Bun's TypeScript loader does not automatically elide type-only re-exports
the way ts-node does, so `export { CustomResponse }` from `src/index.ts`
threw a SyntaxError ("export 'CustomResponse' not found"). Mark it as a
type-only re-export so both runtimes can load the module.

Adds a `test:bun` npm script that runs the existing mocha suite under
Bun's runtime, plus a `Test on Bun` job in the check workflow so Bun
coverage runs on every PR and release.

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4
Mocha keeps the process alive while there are open handles. Under Bun
some sockets in the integration tests stay open after a failure, which
leaves mocha waiting forever and exhausts the job's default 6-hour
timeout. Pass --exit so mocha force-exits after the run, and cap the
Bun job at 15 minutes as a safety net.

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4
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.

3 participants