Add Bun runtime support and fix CustomResponse export#650
Open
Add Bun runtime support and fix CustomResponse export#650
Conversation
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
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
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
test:bunnpm script that runs tests using Bun instead of Node.jsbun_testjob to the GitHub Actions workflow that:test:bunscriptCustomResponseexport from a value export to a type-only export insrc/index.tsto prevent runtime issues and improve tree-shakingImplementation Details
[skip ci]commit message flag, consistent with existing CI jobsbun --bun run mochato execute tests with Bun's runtimeCustomResponseis only available at compile-time, not runtime, which is the correct pattern for TypeScript type definitionshttps://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4