Skip to content

test: enable stale todo tests that now pass - #34857

Merged
Jarred-Sumner merged 4 commits into
mainfrom
farm/a9557427/unskip-30-stale-todos
Jul 21, 2026
Merged

Jarred-Sumner merged 4 commits into
mainfrom
farm/a9557427/unskip-30-stale-todos

Conversation

@robobun

@robobun robobun commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Housekeeping pass: unskip test.todo/it.todo entries whose underlying behavior has since been fixed. Each was verified passing against a debug build at HEAD using bun test --todo (which fails when a todo-marked test body passes).

Enabled (29 tests across 20 files)

File Test
test/js/web/fetch/exiting.test.ts abort the request on the other side if the stream is canceled
test/js/web/fetch/fetch.stream.test.ts should be able to fail properly when reading from readable stream (5 timeout variants)
test/js/web/fetch/fetch-leak.test.ts Request body HiveRef pool returns slot via Body.Value.deinit
test/js/bun/http/bun-serve-args.test.ts number hostnames coerce to string
test/js/bun/http/serve.test.ts Bun.serve hostname with interior NUL byte does not crash
test/js/node/http/node-http-connect.test.ts should handle socket errors during normal requests
test/js/node/tls/node-tls-cert.test.ts Request cert from TLS1.2 client that doesn't have one
test/js/node/url/url-parse-query.test.js with query string
test/js/node/url/url-canParse-whatwg.test.js invalid input
test/js/node/url/url-fileurltopath.test.js invalid input
test/js/node/url/url-parse-format.test.js xss
test/js/deno/url/url.test.ts urlBackSlashes
test/js/node/process/process.test.js process.argv0, exitWithUndefinedFatalException
test/js/web/workers/worker.test.ts worker terminating forcefully properly interrupts
test/js/bun/resolve/resolve.test.ts import override to bun:test
test/js/bun/plugin/plugins.test.ts valid loaders work
test/js/bun/jsc/domjit.test.ts FFI ptr and read
test/js/bun/test/spyMatchers.test.ts throw matcher error if received is spy (toHaveReturned / toHaveReturnedTimes)
test/js/bun/test/jest-extended.test.js toBeValidDate()
test/js/bun/test/expect.test.js 8 of the "to return undefined" cases

Adjusted while enabling

  • node-tls-cert.test.ts: the expected error code was stale. Both Node.js 26 and Bun surface the server-side tlsClientError here, which is ERR_SSL_PEER_DID_NOT_RETURN_A_CERTIFICATE (the old ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE predates the OpenSSL rename and was the client-side code anyway).
  • expect.test.js "to return undefined" block: seven of the nine todo entries were calling matchers with no arguments (e.g. expect({}).toHaveProperty()), so they threw before the return value could be checked. Gave them the same mocked fixture / required args used by the neighboring tests.

Left as test.todo (still fail at HEAD)

  • url-format-invalid-input.test.js and url-parse-invalid-input.test.js invalid input: error message wording still differs.
  • diagnostics_channel.test.ts can handle subscriber errors / can use bind store: depend on uncaughtException handling inside bun:test, which still short-circuits mustCall.
  • mock-module.test.ts adding a default on a module with no default.
  • serve.test.ts text from JS throws on start with no error handler: the uncaught error still marks the test as failed.
  • expect.test.js toContainEqual to return undefined: toContainEqual returns the Expect instance, not undefined.

Not touched

  • websocket-server.test.ts terminate() inside open() calls close() and websocket-permessage-deflate.test.ts WebSocket client rejects compressed control frames have no real test body; enabling them would assert nothing.
  • v8-date-parser.test.js todoOnWindows: already runs on Linux/macOS; leaving the Windows guard in place for a Windows-verified follow-up.
  • fetch-tls-cert.test.ts sibling of the TLS1.2-no-cert test: still blocked because fetch({ tls: { maxVersion } }) is not plumbed through yet (throws ERR_INVALID_ARG_TYPE), so its TODO comment remains accurate.

no test proof · iteration 3 · Platform-specific test-only change; deferring to CI.

Unskip tests across 20 files whose underlying behavior has since been
fixed. Each was verified passing against a debug build at HEAD.

Two tests required small input corrections to be meaningful:
- node-tls-cert.test.ts: update expected error code to
  ERR_SSL_PEER_DID_NOT_RETURN_A_CERTIFICATE (matches Node.js 26).
- expect.test.js 'to return undefined' block: give the matchers valid
  arguments (a mock instead of a bare arrow, required nth/count args)
  so the assertion actually exercises the return value.

Left unchanged because they still fail:
- url-format-invalid-input.test.js, url-parse-invalid-input.test.js
  (error code / message mismatches)
- diagnostics_channel.test.ts subscriber-error / bind-store cases
  (depend on uncaughtException semantics inside bun:test)
- mock-module.test.ts 'adding a default on a module with no default'
- serve.test.ts 'text from JS throws on start with no error handler'
  (uncaught error fails the test)
- expect.test.js 'toContainEqual to return undefined'
  (toContainEqual returns the Expect instance, not undefined)

Not touched: the two placeholder skips with no test body
(websocket-server terminate-inside-open, websocket-permessage-deflate
compressed-control-frames) and the v8-date-parser todoOnWindows guard.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

The pull request enables previously pending tests across Bun runtime APIs, Jest-compatible matchers, Node and Deno compatibility APIs, Fetch behavior, and Worker termination. It also adds Windows gating for one hostname test and updates a TLS error expectation.

Runtime and compatibility test coverage

Layer / File(s) Summary
Bun runtime and module tests
test/js/bun/http/*, test/js/bun/jsc/*, test/js/bun/plugin/*, test/js/bun/resolve/*
Activates HTTP hostname, interior-NUL, FFI, plugin loader, and bun:test import override tests, with Windows-specific hostname skipping.
Matcher behavior tests
test/js/bun/test/*
Activates matcher return-value, date, snapshot, and spy-error assertions.
Node and Deno compatibility tests
test/js/deno/url/*, test/js/node/http/*, test/js/node/process/*, test/js/node/tls/*, test/js/node/url/*
Enables URL, HTTP, process, and TLS cases, including the updated TLS error code expectation.
Fetch and Worker lifecycle tests
test/js/web/fetch/*, test/js/web/workers/*
Activates request cancellation, leak, timeout, and forceful Worker termination coverage.

Possibly related PRs

  • oven-sh/bun#31216: Covers related worker_threads termination behavior exercised by the enabled Worker regression test.

Suggested reviewers: jarred-sumner

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: enabling stale todo tests that now pass.
Description check ✅ Passed The description explains the test-enabling changes, verification command, and known TODOs left untouched.

Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 8:05 PM PT - Jul 20th, 2026

@Jarred-Sumner, your commit 8d06195 is building: #76580

@github-actions

Copy link
Copy Markdown
Contributor

Found 7 issues this PR may fix:

  1. bun:test: return-matcher aliases (toReturn, lastReturnedWith, nthReturnedWith) missing from types #32334 - PR enables tests for toHaveReturnedWith, toHaveNthReturnedWith, toHaveLastReturnedWith, and toHaveReturnedTimes — the return-matcher functions this issue reports as missing from types
  2. Inconsistent validation of percent-encoded file URLs compared to Node.js  #29174 - PR enables the fileURLToPath invalid input validation test, testing percent-encoded file URL validation this issue reports as inconsistent with Node.js
  3. fetch(): aborting an in-flight streaming response via AbortController retains the response body off-heap — RSS grows unbounded until OOM (HTTP/1.1; reader.cancel() does not) #32659 - PR enables fetch stream cancel/abort and readable stream timeout tests, directly testing the abort behavior this issue reports as leaking
  4. ASAN CI: ExceptionScope::assertNoException during worker terminate (worker-transfer-terminate-stress, separate from #34095) #34690 - PR enables the "worker terminating forcefully properly interrupts" test, exercising the worker termination path where this ASAN ExceptionScope assertion was occurring
  5. ASAN CI: JSC assertion in JSObject::getOwnPropertyDescriptor during worker terminate (test-worker-message-port-transfer-terminate) #34095 - PR enables the forceful worker termination test covering the JSC assertion failure during worker terminate this issue describes
  6. TranspilerJob lives inside the VM allocation, so a pool-thread transpile racing worker.terminate() reads freed memory #33936 - PR enables the forceful worker termination test covering the transpile/terminate race condition this issue describes
  7. [CRASH] Worker termination races in-flight fetch(), corrupting the event loop's concurrent task queue (two crash signatures) #33911 - PR enables the forceful worker termination test covering the fetch/termination event loop corruption this issue describes

If this is helpful, copy the block below into the PR description to auto-close these issues on merge.

Fixes #32334
Fixes #29174
Fixes #32659
Fixes #34690
Fixes #34095
Fixes #33936
Fixes #33911

🤖 Generated with Claude Code

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond the inline nit: verified the expect.test.js rewrites reference the shared mocked fixture (defined and called once at ~line 4734), so the new toHaveNthReturnedWith(1, ...) / toHaveReturnedTimes(1) assertions are satisfiable. Also checked the node-tls-cert.test.ts error-code change — the connect() helper rejects with client.err || server.err, and the server-side tlsClientError is ERR_SSL_PEER_DID_NOT_RETURN_A_CERTIFICATE under BoringSSL, so the new expectation is consistent. CI (#76445) will be the real arbiter for the 29 unskips across platforms.

Extended reasoning...

This PR is a test-only housekeeping pass that unskips 29 .todo tests across 20 files, with two non-mechanical adjustments (TLS error code, expect.test.js matcher arguments). One nit was found regarding the fetch.stream.test.ts unskip removing a documented-flaky marker; that inline comment covers the primary concern. I additionally verified the two substantive test-body edits are internally consistent with their surrounding fixtures. Not approving because CI hasn't reported yet and the PR itself defers correctness to CI — a maintainer should confirm the multi-platform run is green before merge.

Comment thread test/js/web/fetch/fetch.stream.test.ts
Windows can't bind a listening socket to hostname "0" (POSIX resolves
it to 0.0.0.0), so the coercion assertion never gets to run there.
Comment thread test/js/node/tls/node-tls-cert.test.ts

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — thanks for looping the fetch.stream variants 200× and checking the fetch-tls-cert sibling. Test-only housekeeping; CI is the real gate for any residual platform sensitivity.

What was reviewed:

  • All 29 un-todo'd tests are pure .todo → test/it swaps except the three documented adjustments (TLS error code, expect.test.js matcher args, Windows skipIf on hostname 0).
  • Prior flakiness concern on fetch.stream.test.ts addressed with a 200-iteration debug loop + green CI lane.
  • fetch-tls-cert.test.ts sibling confirmed still blocked on fetch({tls:{maxVersion}}) and noted in the PR description.
Extended reasoning...

Overview

Test-only PR: removes .todo from 29 tests across 20 files whose underlying behavior now passes at HEAD, verified via bun test --todo. Three non-mechanical adjustments: (1) node-tls-cert.test.ts expected error code updated to the server-side ERR_SSL_PEER_DID_NOT_RETURN_A_CERTIFICATE (verified against Node 26); (2) seven expect.test.js "to return undefined" cases given valid matcher args so they exercise the return value instead of throwing on missing args; (3) bun-serve-args.test.ts hostname-0 test gated with skipIf(isWindows) since Windows can't bind to hostname "0".

Security risks

None. No runtime code touched; only test files. The TLS error-code change is asserting an observed value, not altering TLS behavior.

Level of scrutiny

Low. This is mechanical test housekeeping. The blast radius of a mistake is a red CI lane, not a shipped bug — a newly-enabled test that flakes gets re-.todo'd. No CODEOWNER paths, no production code.

Other factors

Both nits from my prior review pass are resolved: the author looped the previously-flaky-commented fetch.stream abort variants 200× on debug HEAD with zero failures (and cited a green CI build), and confirmed the fetch-tls-cert.test.ts sibling is still legitimately blocked on fetch({tls:{maxVersion}}) plumbing (now noted in the PR description). The e0a283d2 commit adding the Windows guard is a standard platform skipIf with an explanatory comment. The PR description exhaustively documents what was enabled, what was adjusted and why, and what was intentionally left .todo.

@robobun

robobun commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

CI summary across the three runs:

  • #76445: found one real Windows failure (bun-serve-args hostname "0" can't bind on Windows), fixed in e0a283d with skipIf(isWindows).
  • #76468: 261 passed, all 25 Windows lanes canceled due to Azure VM provisioning outage. No failures in the 20 changed files on any lane that ran.
  • #76558: 269 passed. Windows x64 and x64-baseline both ran clean on all 20 changed files. Remaining red is the windows-aarch64 build-rust job timing out (so its test lanes never ran) plus a handful of known flakes unrelated to this diff (cpu-prof.test.ts, complex-workspace.test.ts, bake/deinitialization.test.ts, test-repl-close.js, test-fs-promises-file-handle-readFile.js).

The diff is green on every lane that actually ran it. Ready for review.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — test-only housekeeping, CI-verified across three builds, and both prior nits (fetch.stream flake evidence, fetch-tls-cert sibling) were addressed with concrete evidence.

What was reviewed:

  • All 29 .todo → active flips are mechanical; the two content edits (TLS error code → ERR_SSL_PEER_DID_NOT_RETURN_A_CERTIFICATE, expect.test.js matcher args) are documented and match neighboring fixtures.
  • fetch.stream.test.ts flake concern: author looped 200× on debug HEAD with zero failures; build #76445 cleared all lanes.
  • Windows hostname: 0 bind failure caught in CI and fixed with skipIf(isWindows) + reason comment.
  • fetch-tls-cert.test.ts sibling checked and confirmed still blocked (different code path); noted in PR description.
Extended reasoning...

Overview

Test-only PR flipping 29 test.todo/it.todo entries to active across 20 files. No production code touched. Two test bodies were adjusted while enabling: the TLS1.2-no-cert expected error code (updated to match what both Node 26 and Bun actually surface via tlsClientError), and seven expect.test.js "to return undefined" cases that were previously calling matchers with missing required arguments (now given the same mocked fixture / args as neighbors). One Windows-specific bind failure surfaced in CI and was fixed with a documented skipIf(isWindows).

Security risks

None. No production code, no auth/crypto/permissions logic. The TLS test change updates an assertion to match observed Node.js behavior; it does not touch TLS implementation.

Level of scrutiny

Low-to-medium. Enabling tests only increases coverage — the failure mode is CI flakiness, not shipped bugs. The two content edits warranted a closer look: the TLS error-code change is verified against Node 26 and the PR explains the server-side vs client-side distinction; the expect.test.js edits give matchers valid arguments so the "returns undefined" invariant is actually exercised (previously they threw before reaching the assertion). Both are correct and well-documented.

Other factors

  • Three CI builds: #76445 found the Windows hostname issue (fixed in e0a283d), #76468 passed 261 lanes (Windows canceled by Azure outage), #76558 passed 269 lanes including Windows x64/x64-baseline. Remaining red is windows-aarch64 build-rust infra timeout plus known unrelated flakes.
  • My two prior inline nits are resolved: the fetch.stream.test.ts flake concern was answered with a 200-iteration local loop + all-lane CI pass, and the fetch-tls-cert.test.ts sibling was checked and confirmed still legitimately blocked (fetch({tls:{maxVersion}}) not plumbed) with a note added to the PR description.
  • The PR description explicitly enumerates what was left as .todo and why, satisfying REVIEW.md's "if a site is intentionally excluded, say so."

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/js/bun/test/spyMatchers.test.ts`:
- Around line 596-599: Strengthen the assertions in the spy-received matcher
tests around createSpy and jestExpect, including the corresponding case near the
second referenced test, so they verify the matcher-specific error type or a
precise stable message fragment rather than accepting any thrown error. Preserve
the existing invalid-received validation scenarios while proving they fail
through the intended matcher path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5e23b924-fa2b-4193-ae57-960569110e79

📥 Commits

Reviewing files that changed from the base of the PR and between 483bb32 and 8d06195.

📒 Files selected for processing (20)
  • test/js/bun/http/bun-serve-args.test.ts
  • test/js/bun/http/serve.test.ts
  • test/js/bun/jsc/domjit.test.ts
  • test/js/bun/plugin/plugins.test.ts
  • test/js/bun/resolve/resolve.test.ts
  • test/js/bun/test/expect.test.js
  • test/js/bun/test/jest-extended.test.js
  • test/js/bun/test/spyMatchers.test.ts
  • test/js/deno/url/url.test.ts
  • test/js/node/http/node-http-connect.test.ts
  • test/js/node/process/process.test.js
  • test/js/node/tls/node-tls-cert.test.ts
  • test/js/node/url/url-canParse-whatwg.test.js
  • test/js/node/url/url-fileurltopath.test.js
  • test/js/node/url/url-parse-format.test.js
  • test/js/node/url/url-parse-query.test.js
  • test/js/web/fetch/exiting.test.ts
  • test/js/web/fetch/fetch-leak.test.ts
  • test/js/web/fetch/fetch.stream.test.ts
  • test/js/web/workers/worker.test.ts

Comment thread test/js/bun/test/spyMatchers.test.ts
@Jarred-Sumner
Jarred-Sumner merged commit 9e05560 into main Jul 21, 2026
75 of 77 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the farm/a9557427/unskip-30-stale-todos branch July 21, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants