Skip to content

feat(ci): add Bun runtime jobs (unit + curated/full e2e)#650

Merged
jancurn merged 7 commits into
masterfrom
claude/add-bun-support-529IW
May 12, 2026
Merged

feat(ci): add Bun runtime jobs (unit + curated/full e2e)#650
jancurn merged 7 commits into
masterfrom
claude/add-bun-support-529IW

Conversation

@jancurn
Copy link
Copy Markdown
Member

@jancurn jancurn commented Apr 22, 2026

This PR adds Bun to CI/CD

Summary

Adds Bun runtime support to proxy-chain, mirroring the existing Node.js CI shape.

Changes

  • Unit tests (Bun) job — runs test/unit/** under Bun on every PR.
  • E2E tests (Bun, compatible|full) job — runs the e2e suite under Bun. Scope is controlled by a new bun_e2e_mode workflow input:
    • compatible (default on PRs and the release flow) runs the curated subset of e2e tests known to pass on Bun. Currently the URL-validation tests in test/e2e/tcp_tunnel.js (selected via --grep 'throws error'). Widen as networked tests are confirmed.
    • full runs every e2e file. Opt-in via Actions → Check → Run workflow, picking full for the bun_e2e_mode input.
  • npm scriptstest:bun, test:bun:e2e:compatible, test:bun:e2e:full. All use bun --bun run mocha --no-config --exit:
    • --bun forces Bun's runtime instead of Node when mocha's #!/usr/bin/env node shebang resolves.
    • --no-config skips master's .mocharc.json, which loads tsx for Node ESM/TS — Bun transpiles TypeScript natively and chokes on tsx's conditional exports (Cannot find module './cjs/index.cjs').
    • --exit forces mocha to exit when Bun leaves background handles open after a failing e2e test (this is what stuck the original Bun job for 30+ minutes).
  • NamingE2E testsE2E tests (Node.js 24) so the runtime is visible from the check list, matching Unit tests (Node.js 20/22/24). The two Bun jobs use the same parenthesised qualifier (Unit tests (Bun), E2E tests (Bun, compatible)).
  • Docstest/README.md documents the three Bun scripts, the compatible/full modes, and how to extend test:bun:e2e:compatible as more tests pass under Bun.

Why compatible is narrow

The e2e suite exercises HTTP/1.1 pipelining through ProxyChain.Server and util.promisify(stream.pipeline) over upstream HTTP responses. Both have runtime gaps in Bun 1.3 that cause individual mocha tests to hang on their per-test timeout — the original full-suite run accumulated 8+ minutes of these before falling over with exit 255. compatible mode therefore starts with validation-only coverage; the full job is the canary for tracking the rest as Bun closes those gaps.

Library code

No source changes are needed on top of master — the export type { CustomResponse } fix Bun required is already in the 3.0 release via the CJS-to-ESM migration.

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4

claude added 7 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
…ort-529IW

# Conflicts:
#	.github/workflows/check.yaml
#	package.json
#	src/index.ts
The Bun job timed out on CI running the e2e suite (8m+, exit 255). The
e2e tests exercise HTTP/1.1 pipelining through ProxyChain.Server and
util.promisify(stream.pipeline) over upstream HTTP responses; both have
known runtime gaps in Bun 1.3 that cause individual tests to hang on
their per-test mocha timeout, compounding into the job timeout.

Limit test:bun to the unit suite so we still validate that the library
loads cleanly under Bun and the utility functions behave the same.
Document the scope (and the reason) in test/README.md so the next
contributor doesn't expand it without checking those Bun bugs are
fixed.

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4
- Rename the Bun unit job from 'Tests on Bun' to 'Unit tests on Bun' to
  mirror the Node 'Unit tests' naming.
- Tag the Node e2e job as 'E2E tests (Node.js 24)' so the runtime is
  visible from the check list.
- Add a 'bun_e2e' job that runs the Bun e2e suite. Scope is controlled
  by a new `bun_e2e_mode` workflow input:
    * 'compatible' (default on PRs/release) runs a curated subset of
      e2e files (currently tcp_tunnel.js + socks.js) that exercise
      Bun-friendly code paths.
    * 'full' runs the entire e2e suite. Triggered manually via
      Actions → Check → Run workflow.
- Add `test:bun:e2e:compatible` and `test:bun:e2e:full` npm scripts and
  document the toggle (and how to extend the compatible subset) in
  test/README.md.

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4
The previous compatible subset (tcp_tunnel.js + socks.js) had 4 of 8
test failures on CI. Without log access from this sandbox I can't
attribute them to specific tests, so falling back to the minimal subset
that is guaranteed to be Bun-safe: the two URL-validation tests in
test/e2e/tcp_tunnel.js (selected via --grep 'throws error'). They
exercise createTunnel's error paths through chai+mocha without binding
sockets, opening upstream HTTP, or otherwise touching the Bun runtime
gaps. The README explains how to widen the subset as networked e2e
tests are confirmed.

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4
Node.js jobs use parenthesised qualifiers (Unit tests (Node.js 24),
E2E tests (Node.js 24)). Bring the Bun jobs into the same shape:

- Unit tests on Bun           → Unit tests (Bun)
- E2E tests on Bun (compatible) → E2E tests (Bun, compatible)

https://claude.ai/code/session_01PE9wGrZ1wb7Nuq9czWjJz4
@jancurn jancurn changed the title Add Bun runtime support and fix CustomResponse export feat(ci): add Bun runtime jobs (unit + curated/full e2e) May 11, 2026
@jancurn jancurn requested review from bliuchak and jirimoravcik May 11, 2026 14:57
@jancurn jancurn merged commit 5af20c6 into master May 12, 2026
9 checks passed
@jancurn jancurn deleted the claude/add-bun-support-529IW branch May 12, 2026 09:56
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.

5 participants