Repository navigation
Conversation
…reports node-test.test.ts spawned ~30 `bun test` children one after another. The describe is now concurrent, the children no longer load the repo preload, and every fixture run asserts its exact ordered (pass)/(fail)/(skip)/(todo) lines, error messages, summary counts and stdout instead of a substring.
…t capture Keep runTests(filenames, env, args) and return the raw stdout/stderr too, so the other open changes to this file still work after a rebase. The exit-code assertion carries the child's stderr as its message. `report` also captures `SomeError: ...` lines and the unhandled-error banner. The mock.property spawn test is back at the end of the file, unchanged.
|
Status: ready for review. How this was verified, on an 8-core container:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. WalkthroughThe node:test integration suite now runs fixture-specific concurrent tests with normalized output parsing and exact assertions. Hook fixtures now print recorded execution order for validation. ChangesNode test runner validation
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to This strengthens and accelerates node:test integration coverage without changing runtime source code, and no actionable merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
LGTM — test-only hardening that strengthens assertions and speeds up the suite.
What was reviewed:
runTestshelper:await using+Promise.allpipe drain, regex parsing of report/summary lines and duration stripping look correct;cwd: fixturesDirkeeps headers to bare filenames and skips the repo preload.- Concurrency safety: verified no fixture writes to disk, so
describe.concurrentchildren share nothing mutable; the one--concurrentfixture run sorts before comparing. - Fixture edits: the removed
%AFTER%marker in02-hooks.jshas no other consumers; newconsole.loglines feed the exactstdoutLinesassertions.
Extended reasoning...
Overview
This PR touches only test/js/node/test_runner/node-test.test.ts and two of its fixture files. It replaces ~30 loose expect.stringContaining("N pass" / "0 fail") assertions with exact toEqual comparisons against a parsed per-test report array and a summary object, switches the outer describe to describe.concurrent, drops per-test 30 s timeouts, sets cwd to the fixtures directory (avoids the repo bunfig.toml preload and yields bare-filename headers), and adds two console.log lines to fixtures so stdout can be asserted exactly. No src/ code changes.
Security risks
None. Test-only change; no network, no filesystem writes, no credential handling, no new dependencies. Children spawn bunExe() with bunEnv over read-only fixture files.
Level of scrutiny
Low-to-moderate. The change is mechanical and moves the file squarely toward the repo's stated test conventions: strongest-invariant assertions (toEqual over toContain), content asserted before exit code, await using + concurrent pipe drain, describe.concurrent for independent subprocess spawns, and no ad-hoc timeouts. I read the new runTests parser regexes (file header, error:/SomeError: lines, (pass|fail|skip|todo) with duration strip, summary counters with \r?$ for Windows) and they match Bun's test-reporter output shape. The --concurrent variant correctly sorts both sides before comparing since completion order is nondeterministic.
Other factors
No CODEOWNERS entry covers these paths. Grep confirmed no fixture performs filesystem writes, so concurrent children cannot interfere. The removed %AFTER% sentinel in 02-hooks.js has no remaining consumers anywhere in the repo. The PR timeline shows no prior reviews or outstanding objections, and the bug hunt ran to dry_streak with no findings.
|
Updated 3:12 PM PT - Sep 9th, 2026
✅ @robobun, your commit 417400e31df6e53c1e25c0a93527257238e7bba1 passed in 🧪 To try this PR locally: bunx bun-pr 42149That installs a local version of the PR into your bun-42149 --bun |
Problem
test/js/node/test_runner/node-test.test.tstook 12 s on the debian 13 x64-asan lane. About 30 of its tests spawned abun test <fixture>child, one at a time.exitCodeand a"0 fail"or"N pass"substring. That passes when a fixture registers no tests or prints an unexpected error.Fix
node:testdescribe isdescribe.concurrent, without explicit timeouts. An ASAN build caps concurrent tests at 5, so the children do not pile up.runTestsspawns withawait usingand the fixtures directory ascwd, so the children skip the repobunfig.tomlpreload (a quarter of a debug child's time). Its signature and raw output stay for the other open changes to this file.runTestsalso returnsstdoutLines,report(each file header, error message and(pass|fail|skip|todo)line, in order) andsummary(the printed counters). Every fixture run asserts all three withtoEqual.bun bd teston this file (debug+ASAN) went from 69.73 s to 14.54, 14.76 and 14.54 s in three runs, 45 pass each. Release: 1.95 s to 0.75 s. Self-reviewed: 4 concerns raised, 2 addressed, 2 are follow-ups outside this file.Background
node:testfile that runs underbun testin a child. Hooks,assert.register()and module-scope mocks are scoped per file, and several fixtures check that isolation. So each test keeps its own child.bun testreadsbunfig.tomlfrom its working directory only. At the repo root it namestest/preload.ts.Notes
Assertion changes per fixture:
(pass|fail|skip|todo)lines and exact summary counts (pass,skip,todo,fail,filtered out, plustestsandfilesfromRan N tests across M files) for every fixture run: 01, 02, 03, 04, 01+02, 05, 06, 07, 08, 09, 10, 11, 12 (serial and--concurrent), 13, 14a+14b, 15, 16, 16b, 17 (per--rerun-eachrun), 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29. Anyerror:/SomeError:line, unhandled-error banner orN errorcounter that a passing fixture did not print before fails the comparison.(fail)line it precedes: 07 (all ten, for examplepassed a callback but also returned a Promise,callback invoked multiple times,test timed out after 1ms), 16b (test timed out after 100ms), 24 (1 subtest failedthenboom), 27 and 28 (test was expected to fail but passed), 29 (The test failed, but the error did not match the expected validationand the validator'sAssertionError), 13 (the two todo bodies' errors, which proves the bodies ran under--todo).after()and the test compares it with02-hooks.json(alone and in the two-file run). 05-test-in-test prints the subtest order from itst.after()hook, so the test also proves that hook ran. 07 (SUB_BODY_RAN=false) and 26 (only the todo suite body prints) compare the whole stdout instead oftoContain/not.toContain.bun testprints concurrent tests in completion order, so the one--concurrentfixture run (12) compares itsreportsorted.Timings on this machine (8 cores),
bun bd test test/js/node/test_runner/node-test.test.ts(debug+ASAN): before 69.73 s, after 14.54 s / 14.76 s / 14.54 s.USE_SYSTEM_BUN=1 bun test(release): before 1.95 s, after 0.75 s. A debug child took about 2.05 s with the repo preload and 1.47 s without it. The slowest single test under debug+ASAN takes about 2 s, under the 5 s default.Stability: five extra release runs and two debug runs under eight CPU-burning processes all passed. Fixtures with timers (07's 1 ms hook timeout against a 200 ms settle, 11's 300 ms sleeps against a 3000 ms timeout, 12's
waitFor, 16b's 100 ms timeout) compare outcomes, not durations.Review follow-ups left out on purpose, both outside this file: the ASAN-only cap of 5 concurrent tests (
src/options_types/context.rs) could also apply to plain debug builds, andtest/preload.tscould import a lighter module than the whole harness.Nothing under
src/changed. No fixture writes to disk, so the concurrent children share nothing but read-only files.[auto-merge] gate passed · iteration 2 · 3 files touched
passes on PR (with fix)
diff hotspot
gate history · 2 passed · 0 rejected · iteration 2
evidence per changed file