Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
385 commits
Select commit Hold shift + click to select a range
30635b8
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 16, 2026
58af4e3
FormData: an entry's File is one object, and takes the file name that…
Jarred-Sumner Oct 16, 2026
1ce1b2c
onLoad gets the path of the file for the original of a mocked module
Jarred-Sumner Oct 16, 2026
d8f1390
bun test: a Vitest test file runs its imports in turn, also without a…
Jarred-Sumner Oct 16, 2026
77bbad7
bun test: the assertion on test-only transforms allows for a test ent…
Jarred-Sumner Oct 17, 2026
a41cabb
bun test --react-compiler
Jarred-Sumner Oct 17, 2026
b33e823
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 17, 2026
289d164
The transpiler cache keeps a file the React Compiler ran on, whatever…
Jarred-Sumner Oct 17, 2026
c77e982
test: two WebSocket tests spin the event loop with Bun.build()
Jarred-Sumner Oct 17, 2026
8898d53
bun test --react-compiler: find the query with strings::index_of_char
Jarred-Sumner Oct 17, 2026
3e28849
bun test --react-compiler: a slice for the pattern, and a binding for…
Jarred-Sumner Oct 17, 2026
a9b33bd
Module mocks: one reaction on each load that modules to evict wait for
Jarred-Sumner Oct 17, 2026
72ccd6b
test: a builtin module may export a class that extends the native one
Jarred-Sumner Oct 17, 2026
ff850bc
Reword comments and test names in plain English
Jarred-Sumner Oct 17, 2026
0dcd213
React Compiler: compile a component that spreads an object with a com…
Jarred-Sumner Oct 17, 2026
b932c5b
React Compiler: consider every function babel-plugin-react-compiler c…
Jarred-Sumner Oct 17, 2026
649b82f
bun test: resolve reactCompiler entries against the run directory
Jarred-Sumner Oct 17, 2026
f969f27
React Compiler: don't report a captured local that is named like a ref
Jarred-Sumner Oct 17, 2026
bbf24b0
test: minify.syntax removes the statement that holds one fixture's on…
Jarred-Sumner Oct 17, 2026
d31e8ab
Module mocks: give up on a replaced factory that nothing is waiting for
Jarred-Sumner Oct 17, 2026
7940a2c
React Compiler: compile a function that has a for loop without a test
Jarred-Sumner Oct 17, 2026
1b4a3e8
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 17, 2026
57f090f
Module mocks: don't wake the import() of a factory that nothing waits…
Jarred-Sumner Oct 17, 2026
d3e95f3
expect(() => promise).toThrow() calls then() of a pending Promise sub…
Jarred-Sumner Oct 17, 2026
ac098a1
test: a stray word on the stack can keep more than one finished file …
Jarred-Sumner Oct 17, 2026
6255381
vi.useFakeTimers() of "vitest" leaves AbortSignal.timeout() on the re…
Jarred-Sumner Oct 17, 2026
016e068
JUnit reporter: report an attempt that timed out like any other faile…
Jarred-Sumner Oct 17, 2026
779943e
Put a SAFETY comment directly above its unsafe block
Jarred-Sumner Oct 17, 2026
d6fea3e
Print a frame whose path has parentheses correctly after error.stack …
Jarred-Sumner Oct 17, 2026
f652b79
Module mocks: a factory that nothing waits for stays connected to its…
Jarred-Sumner Oct 17, 2026
29e3dda
WebKit: a search with a repeated group inside a lookaround stays in t…
Jarred-Sumner Oct 17, 2026
8e1f70f
Module mocks: listing the keys of a barrel runs no getter of the mock…
Jarred-Sumner Oct 17, 2026
725622d
--parallel: print what a file printed under that file's name
Jarred-Sumner Oct 17, 2026
732152c
vi.waitFor(), vi.waitUntil() and expect.poll() move a fake clock as i…
Jarred-Sumner Oct 17, 2026
0af0c53
In a test of Vitest's, arrays of different lengths are never equal
Jarred-Sumner Oct 17, 2026
ac49745
Fake timers: what a test put on Date.now or performance.now makes way…
Jarred-Sumner Oct 17, 2026
adf55af
In a test of Vitest's, two errors are compared as in Vitest
Jarred-Sumner Oct 17, 2026
f7cb9a6
toThrow() leaves promises that were rejected before the call alone
Jarred-Sumner Oct 17, 2026
c5b70ac
node:util: add diff()
Jarred-Sumner Oct 17, 2026
b01eec8
Optimize more cold functions of the test runner for size
Jarred-Sumner Oct 17, 2026
0e7c0da
Don't optimize the recursive functions of the value printer for size
Jarred-Sumner Oct 17, 2026
ac7185c
node:http2: a stream that is finished or reset before the response
Jarred-Sumner Oct 17, 2026
5d7f588
vi.doMock() leaves a module that is already loaded as it is
Jarred-Sumner Oct 17, 2026
d9cd0b7
node:http2: close(code) sends RST_STREAM once
Jarred-Sumner Oct 17, 2026
40885f3
node:http: destroying a response before anything is sent no longer se…
Jarred-Sumner Oct 17, 2026
e3a330a
bun test turns off tail calls
Jarred-Sumner Oct 17, 2026
0f2d4ea
Module mocks: trace an import() to the factory that called it, not to…
Jarred-Sumner Oct 17, 2026
47a7bdd
Module mocks: two factories can't wait for each other through the mod…
Jarred-Sumner Oct 17, 2026
94247a2
vi.useFakeTimers() starts the clock at what Date.now() returns
Jarred-Sumner Oct 17, 2026
3edb6c1
node:http2: close(code) on an open response sends RST_STREAM, not END…
Jarred-Sumner Oct 18, 2026
07450e5
Module mocks: a factory's imports don't copy bun's own helper module,…
Jarred-Sumner Oct 18, 2026
c85e78b
node:http2: after session.destroy(), 'close' follows the socket's
Jarred-Sumner Oct 18, 2026
6145682
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 18, 2026
d20b1ae
bun test --react-compiler: importing a data: URL longer than a path n…
Jarred-Sumner Oct 18, 2026
dd90322
bun test: report the files that could not be loaded, were cut short o…
Jarred-Sumner Oct 18, 2026
61eecf2
Compile generate_import_stmt once per parser, and more cold functions…
Jarred-Sumner Oct 18, 2026
0eb8e98
react-compiler: keep all of the text that the parser joined onto a te…
Jarred-Sumner Oct 18, 2026
1c92a47
bun test: --globals and [test] globals accept Vitest's true and false
Jarred-Sumner Oct 18, 2026
6cc4988
ci: run a file again quietly if a crash in another file kept it from …
Jarred-Sumner Oct 18, 2026
db24898
test: vi-utils.test.ts expects the file that does not load in the lis…
Jarred-Sumner Oct 18, 2026
8cef2ae
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 18, 2026
c6bd3ed
bun test: use writeln! for the line of a file that failed to load
Jarred-Sumner Oct 18, 2026
040f46a
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 18, 2026
9fb3f89
bun test: call the mock factories of one load one at a time, in impor…
Jarred-Sumner Oct 18, 2026
d55ecf3
bun test --parallel: the JUnit report tells an interrupted file from …
Jarred-Sumner Oct 18, 2026
5e33024
Remove haveUnfinishedImporterInCommon()
Jarred-Sumner Oct 18, 2026
ce4e79b
BunPlugin.cpp: don't bind the result of std::minmax() to temporaries
Jarred-Sumner Oct 18, 2026
8ac5074
bun test: two import() calls that share a module keep separate turns
Jarred-Sumner Oct 18, 2026
42c17b6
bun test: call mock factories in import order also if a later one's m…
Jarred-Sumner Oct 18, 2026
9a744c1
bun test: the factories that a factory's import calls run in the orde…
Jarred-Sumner Oct 18, 2026
178fe79
bun test: don't walk the module graph for every mock that asks for it…
Jarred-Sumner Oct 18, 2026
3237fd5
bun test: run afterEach before any other pending callback
Jarred-Sumner Oct 18, 2026
c7e4231
bun test: don't run a module twice when a mock factory imports it mid…
Jarred-Sumner Oct 18, 2026
a222d57
bun test: add timestamps, empty suites and an uncaught mark to the JU…
Jarred-Sumner Oct 18, 2026
8dbfa89
docs: say exactly when the JUnit report marks an error as uncaught
Jarred-Sumner Oct 19, 2026
feb02f3
expect: treat any object with an asymmetricMatch() method as a matcher
Jarred-Sumner Oct 19, 2026
6d55d36
bun test: fix invalid XML, missing retry attempts and empty describe …
Jarred-Sumner Oct 19, 2026
9d94969
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 20, 2026
a00885a
builtins: read the native TextDecoder and Crypto, not globalThis's
Jarred-Sumner Oct 20, 2026
1bbec87
glob: compile the file-system walker once for Bun.Glob and import.met…
Jarred-Sumner Oct 20, 2026
9fdc2fe
bun test --isolate=modules: don't undo what builtin modules patch, an…
Jarred-Sumner Oct 20, 2026
dc15e98
bake: export __rawTemplate from the dev server's bun:wrap
Jarred-Sumner Oct 20, 2026
0b1071f
perf_hooks: enable() doesn't reset an event loop delay histogram that…
Jarred-Sumner Oct 20, 2026
2be51f4
fake timers: don't crash in useRealTimers() after Date.prototype.cons…
Jarred-Sumner Oct 20, 2026
eba5482
bun test: bound the wait for a finished file's in-flight imports
Jarred-Sumner Oct 20, 2026
8f1011f
bun test: delete process.env.TZ goes back to the time zone the run st…
Jarred-Sumner Oct 20, 2026
f84fa31
bun test: a 0 ms timeout that _repeat turns into an interval waits fo…
Jarred-Sumner Oct 20, 2026
1707ee4
bun test --isolate=modules: Module._cache is the running file's requi…
Jarred-Sumner Oct 20, 2026
7bf8adf
bun test: delete process.env.TZ goes back to the system's zone if ICU…
Jarred-Sumner Oct 20, 2026
a383fb3
bun test: jsdom fixes for FormData files and aborted signals
Jarred-Sumner Oct 20, 2026
e27b38e
process.mainModule is not cached
Jarred-Sumner Oct 20, 2026
d759fdb
bun test: vi.useFakeTimers() of "vitest" replaces the performance object
Jarred-Sumner Oct 20, 2026
db2c5f7
bun test: "vitest" exports inject
Jarred-Sumner Oct 20, 2026
29a25c9
Fix the type of the fake performance object
Jarred-Sumner Oct 20, 2026
39a7e3f
fake timers: useFakeTimers() changes nothing if it throws, and a dela…
Jarred-Sumner Oct 20, 2026
d5d58f8
expect: print React 19 elements as JSX, and bound the length of a fai…
Jarred-Sumner Oct 20, 2026
b6d5232
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 20, 2026
19774e7
Restore the bytecode portability snapshot
Jarred-Sumner Oct 20, 2026
fbf1ae4
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
b7f1aa5
Give the zero-delay timer test more room on slow machines
Jarred-Sumner Oct 21, 2026
f9bd377
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
a9bb6ca
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
010a5f7
ws: the handshake and close timers follow fake timers again
Jarred-Sumner Oct 21, 2026
f5a28ee
Restore the importMetaResolve debug log
Jarred-Sumner Oct 21, 2026
125d6ca
Find the chai that pnpm links next to vitest
Jarred-Sumner Oct 21, 2026
8504fad
Fix a race in the renegotiating test server
Jarred-Sumner Oct 21, 2026
5386abe
import.meta.resolve: give onResolve the path of a file: URL parent
Jarred-Sumner Oct 21, 2026
188f1be
Close the servers of the ws timer tests when an assertion fails
Jarred-Sumner Oct 21, 2026
1001ff7
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
a12edf7
bun test: ignore a callback's rejection after its time limit
Jarred-Sumner Oct 21, 2026
a1ef870
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
e81e383
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
879079a
Turn two helper lambdas with exception checks into functions
Jarred-Sumner Oct 21, 2026
67410e6
Compile cold test runner code for size
Jarred-Sumner Oct 21, 2026
8130ea5
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
70a7008
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 21, 2026
ed4d76a
docs: Object.keys(import.meta.glob()) imports nothing
Jarred-Sumner Oct 22, 2026
08b6696
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 22, 2026
e1d9357
bun test --isolate: reset macros in one place, and free the macro con…
Jarred-Sumner Oct 22, 2026
40f3eb1
Run the event loop with Bun.build() in three tests that used expect()…
Jarred-Sumner Oct 22, 2026
7f7e23c
junit: report a concurrent test's earlier attempts under that test
Jarred-Sumner Oct 22, 2026
3aae770
child_process test: use tempDir
Jarred-Sumner Oct 22, 2026
749838c
junit: report a concurrent test's error under that test
Jarred-Sumner Oct 22, 2026
4af2e8a
next-auth test: don't wait for the npm registry when the dev server s…
Jarred-Sumner Oct 22, 2026
f56efff
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 22, 2026
3339234
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 22, 2026
cfbf728
test: fix two clippy lints in the test runner
Jarred-Sumner Oct 23, 2026
cda8ede
bindgen: test the protoCaller and callInstance class keys
Jarred-Sumner Oct 23, 2026
93d92b9
node:http2: emit 'finish' when a server stream ends before respond()
Jarred-Sumner Oct 23, 2026
4795aad
test: register equality testers and snapshot serializers once per fil…
Jarred-Sumner Oct 23, 2026
8e0e818
test: drop the per-test timeouts from the snapshot tests
Jarred-Sumner Oct 23, 2026
f3b0f07
test: fix three snapshot file bugs with --update-snapshots and files …
Jarred-Sumner Oct 23, 2026
c7e9d73
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 23, 2026
ae59c21
bindgen: protoCaller gets a function pointer, so expect() has one cal…
Jarred-Sumner Oct 23, 2026
d9ea20e
bindgen: read the first argument with first(), as clippy asks
Jarred-Sumner Oct 23, 2026
be0a95b
Blob: a clone keeps the type of its Blob byte for byte
Jarred-Sumner Oct 23, 2026
1be37f0
bun-types: add opt-in types for the built-in "vitest" module
Jarred-Sumner Oct 23, 2026
1a7a2dd
bun-types: document where assert from "vitest" doesn't work
Jarred-Sumner Oct 23, 2026
2db91c0
ObjectModule: explain why the Weak's context pointer is always valid
Jarred-Sumner Oct 23, 2026
7b6e388
bun test: a timeout interrupts a test that never returns to the event…
Jarred-Sumner Oct 23, 2026
2705a15
Revert "bun test: a timeout interrupts a test that never returns to t…
Jarred-Sumner Oct 23, 2026
6ce4400
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 24, 2026
b27a881
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 24, 2026
7f530fb
bun test: one native function for all hooks
Jarred-Sumner Oct 24, 2026
e0ec02c
bun test: use is_multiple_of() in hook(), for clippy
Jarred-Sumner Oct 24, 2026
0267680
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
c8132e1
Bun.plugin: skip onResolve for a specifier that a namespaced onLoad m…
Jarred-Sumner Oct 27, 2026
4bb1507
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
4b55587
import-meta-glob.test.ts: load the virtual modules without onResolve
Jarred-Sumner Oct 27, 2026
8af2ea3
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
cae009d
perf_hooks.test.ts: don't expect a prototype's non-enumerable members
Jarred-Sumner Oct 27, 2026
be98d02
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
0cb60d7
jsc-stress: update two fixtures for the new WebKit build
Jarred-Sumner Oct 27, 2026
da578ff
bun test: a mock function should only re-chain the prototype object i…
Jarred-Sumner Oct 27, 2026
49fcc2c
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
604704e
jsc-stress: make four RegExp fixtures faster
Jarred-Sumner Oct 27, 2026
9ed4b8b
parallel-startup-failure.test.ts: run the crash-on-exit test with one…
Jarred-Sumner Oct 27, 2026
c70c46d
bun test: build two short lists in order instead of sorting them
Jarred-Sumner Oct 27, 2026
eeda8f9
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
fa28b8f
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
5fb0ad5
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 27, 2026
2c96754
css-loader.test.ts: update the CSS module expectations after #47025
Jarred-Sumner Oct 27, 2026
64a3dcf
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 28, 2026
833709d
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 28, 2026
8108c8c
The generators of bun:test and bun:test/vitest should not be inlined
Jarred-Sumner Oct 28, 2026
dad7225
ImportMetaGlobHost should be a function pointer
Jarred-Sumner Oct 28, 2026
3c1f7d6
bun test --debug-aot should report what bun test reports
Jarred-Sumner Oct 28, 2026
dcbcbdd
The built-in modules should pass the type check
Jarred-Sumner Oct 28, 2026
d38dbf7
may_compile_by_name should name the two flags it passes
Jarred-Sumner Oct 28, 2026
f9fa422
trim: a COFF section numbered past 32,767 should keep its symbols
Jarred-Sumner Oct 28, 2026
39b11fd
--trim should remove the test runner again
Jarred-Sumner Oct 28, 2026
f9cb33b
process.mainModule should be an accessor only under bun test
Jarred-Sumner Oct 28, 2026
a372b68
bun test --debug-aot should give a file the names that bun test gives it
Jarred-Sumner Oct 28, 2026
5029dc1
Tests that came with --aot should expect what this branch does
Jarred-Sumner Oct 28, 2026
3f0dd4f
Pin the WebKit preview of 1fb1904f
Jarred-Sumner Oct 28, 2026
cefe1c8
spyOn through a Proxy should not run its traps with built-ins unlocked
Jarred-Sumner Oct 28, 2026
462357c
Module._extensions in a compiled program should not crash
Jarred-Sumner Oct 28, 2026
40e0eaa
A snapshot of a mock function or a native class from an older Bun sho…
Jarred-Sumner Oct 28, 2026
81749bb
bun test --debug-aot should follow --globals=vitest
Jarred-Sumner Oct 28, 2026
d6a2ba6
--trim should remove the runner's printer and new classes, and the CS…
Jarred-Sumner Oct 28, 2026
e5453e1
More tests that came with --aot should expect what this branch does
Jarred-Sumner Oct 28, 2026
0ef2209
A compiled test file that imports a runner should keep a preload's gl…
Jarred-Sumner Oct 28, 2026
42218c3
Restoring a spy should look the property up before it unlocks built-ins
Jarred-Sumner Oct 28, 2026
a346623
default_is_plain_compile should list has_globals_of_vitest
Jarred-Sumner Oct 28, 2026
c264443
bun test --debug-aot should run fake timers, spies and mocks as bun t…
Jarred-Sumner Oct 28, 2026
8fa1b8f
Tests added on this branch should pass the type check of --debug-aot
Jarred-Sumner Oct 28, 2026
0b67c41
Tests of what compiled code does differently should be listed as know…
Jarred-Sumner Oct 28, 2026
697a158
A matcher should work after expectTypeOf().parameter() and the six me…
Jarred-Sumner Oct 28, 2026
fdbcf03
this.equals() should compare without testers when its third argument …
Jarred-Sumner Oct 28, 2026
065052a
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 28, 2026
63c4096
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 28, 2026
3eda2ca
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
63c0d76
bun test --isolate=modules should wait for an unref'd fs.watch()
Jarred-Sumner Oct 29, 2026
36e7617
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
e102d60
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
07f4674
createPerformance should not shift the ids of the other built-in func…
Jarred-Sumner Oct 29, 2026
b89fe1e
Four tests that are new on main should expect what this branch changes
Jarred-Sumner Oct 29, 2026
a72c244
The SAFETY comment in has_handles_off_the_loop should precede its uns…
Jarred-Sumner Oct 29, 2026
042ca8e
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
d7fe8b9
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
644ea3c
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
d9aaca7
Upgrade WebKit: a failed stream should be collected
Jarred-Sumner Oct 29, 2026
94f2645
drain_microtasks_with_global should not grow for `bun test`
Jarred-Sumner Oct 29, 2026
8327a8b
Upgrade WebKit: a smaller frame for Interpreter::executeCall
Jarred-Sumner Oct 29, 2026
55f5f7a
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
b5f7cc7
vi.mock() of a package should reach every module that Vitest doesn't …
Jarred-Sumner Oct 29, 2026
ecc1e1c
docs: a second vi.doMock() of a module should be listed with vi.doUnm…
Jarred-Sumner Oct 29, 2026
1a3864e
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
164fbac
done(error) should end the test and count as an uncaught exception
Jarred-Sumner Oct 29, 2026
dceff58
A mock should reach the requirers of a package that was loaded while …
Jarred-Sumner Oct 29, 2026
02382ef
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 29, 2026
a4be7dd
--isolate: a test file should not be taken from the SourceProvider ca…
Jarred-Sumner Oct 29, 2026
cb8dc40
expect(node).toContain(otherNode) should check DOM containment in a V…
Jarred-Sumner Oct 29, 2026
58a7a2b
--isolate: the entry point should still be added to the SourceProvide…
Jarred-Sumner Oct 29, 2026
49719d1
--isolate: an import of a test file should not get the code made for …
Jarred-Sumner Oct 29, 2026
750f313
--isolate=modules: Bun.argv should be reset for each test file, like …
Jarred-Sumner Oct 30, 2026
46e0a53
--isolate: an import of a preload should not get the code made for it…
Jarred-Sumner Oct 30, 2026
b9e43ea
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 30, 2026
84c6b82
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 30, 2026
2ee1f99
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 31, 2026
4a7ac24
import.meta.glob should call bun_glob::walk_bun_glob
Jarred-Sumner Oct 31, 2026
41a976c
require() of a mocked builtin should return the original until an asy…
Jarred-Sumner Oct 31, 2026
9f25c16
Request should not define keepalive while fetch() reads false as no c…
Jarred-Sumner Oct 31, 2026
f2033c9
--config followed by a space should behave as on main
Jarred-Sumner Oct 31, 2026
8a61b41
node:http2: a stream reset by the client should emit 'finish', and a …
Jarred-Sumner Oct 31, 2026
b48436a
happy-dom with --isolate: binary data that Bun makes should be an ins…
Jarred-Sumner Oct 31, 2026
a5d61a4
timers/promises should clear its timers with the globals that were th…
Jarred-Sumner Oct 31, 2026
273e948
The count of native getters should be main's again without Request.ke…
Jarred-Sumner Oct 31, 2026
312f288
Upgrade WebKit to 4db1b25a23f4
Jarred-Sumner Oct 31, 2026
88e0496
require() should return the original of a mocked module while its asy…
Jarred-Sumner Oct 31, 2026
5206f62
The build should match the schema generator and the sizes of WebKit 4…
Jarred-Sumner Oct 31, 2026
c70648a
require() should return a mock that has settled after an earlier requ…
Jarred-Sumner Oct 31, 2026
434a958
Delete the tests that read the engine's sources
Jarred-Sumner Oct 31, 2026
182335f
The lists of test files should not mention the deleted tests
Jarred-Sumner Oct 31, 2026
dd50c2b
require() should return the mock when an async factory awaits nothing
Jarred-Sumner Oct 31, 2026
721b347
A hoisted mock factory that reads a later variable should wait for th…
Jarred-Sumner Oct 31, 2026
9e42b0f
Whether an async mock factory awaits should come from the parser, not…
Jarred-Sumner Oct 31, 2026
98060ee
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 31, 2026
efa0bc8
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 31, 2026
c397f02
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 31, 2026
e828d57
A default import should get the object that a jest.mock() factory ret…
Jarred-Sumner Oct 31, 2026
ed9c7e8
An idle process.stdout should not count as work left under --isolate
Jarred-Sumner Oct 31, 2026
a161bb6
The report that nothing is left to wait for should be out of line in …
Jarred-Sumner Oct 31, 2026
b01a298
Four tests that are new on main should expect what this branch changes
Jarred-Sumner Oct 31, 2026
8f06732
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 31, 2026
43dec97
Revert "The report that nothing is left to wait for should be out of …
Jarred-Sumner Oct 31, 2026
c76108b
ReactCompilerState::may_compile_by_name should go with its last caller
Jarred-Sumner Oct 31, 2026
40c7f9f
isMockFunction and skip should be on the list of functions that narro…
Jarred-Sumner Oct 31, 2026
a47be51
bun test should make tail calls again, except for the calls that read…
Jarred-Sumner Oct 31, 2026
c0974df
Merge branch 'main' into claude/vitest-compat
Jarred-Sumner Oct 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
vendor
test/snapshots
# written by Jest and Vitest, and compared byte for byte
test/js/bun/test/snapshot-tests/formats
test/bundler/transpiler/react-compiler-fixtures
src/**/*.generated.rs
test/js/deno
Expand Down
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/bundler/css.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,8 @@ This outputs:

The class names are unique to each file, so they don't collide.

Importing a CSS module at runtime (`bun run`, `bun test`) gives you the same object. Server-rendered markup and component tests see the same class names the bundler emits, as long as both run from the same working directory.

### Composition

CSS modules can compose class selectors together to reuse style rules across multiple classes.
Expand Down
6 changes: 4 additions & 2 deletions docs/guides/test/migrate-from-jest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ Bun implements most of Jest's matchers, but compatibility isn't 100%. See the co

---

If you use `testEnvironment: "jsdom"` to run your tests in a browser-like environment, follow the [DOM testing with Bun and happy-dom](/guides/test/happy-dom) guide to inject browser APIs into the global scope. That guide uses [`happy-dom`](https://github.com/capricorn86/happy-dom), a leaner and faster alternative to [`jsdom`](https://github.com/jsdom/jsdom).
Replace `testEnvironment: "jsdom"` in your Jest config with `environment` in `bunfig.toml`, and install `jsdom` itself (`bun add -d jsdom`). [`happy-dom`](https://github.com/capricorn86/happy-dom) is a leaner and faster alternative.

```toml bunfig.toml icon="settings"
[test]
preload = ["./happydom.ts"]
environment = "jsdom"
```

`@jest-environment jsdom` and `@jest-environment node` comments in test files work as-is. If a comment uses a name Bun doesn't support, such as `jest-environment-jsdom`, Bun prints a warning and runs the file without a DOM. Change it to `jsdom` or `node`. See [DOM testing](/test/dom#test-environments).

---

Replace `bail` in your Jest config with the `--bail` CLI flag.
Expand Down
1 change: 1 addition & 0 deletions docs/project/benchmarking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ BUN_OPTIONS="--cpu-prof-md" bun script.js
```sh terminal icon="terminal"
bun --cpu-prof --cpu-prof-name my-profile.cpuprofile script.js
bun --cpu-prof --cpu-prof-dir ./profiles script.js
bun test --cpu-prof --cpu-prof-dir ./profiles # with --parallel, one profile for each worker
```

| Flag | Description |
Expand Down
24 changes: 24 additions & 0 deletions docs/project/bindgen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ is collected, make the class [`refCounted`](#refcounted).
| `final` | `false` lets a class with `extends`, or hand-written C++, subclass `JSName` |
| `overridesToJS` | with `refCounted`: `impl JsClass` is not generated; write it by hand with `js_Name::to_js` |
| `forBind` | the receiver of every member is [a function bound to an instance](#forbind) |
| `protoCaller` | the method that [calls every native function of `proto`](#protocaller) |
| `rustTraits` | traits to bring into scope, for members that are trait methods |
| `prototypeBase` | `"Error"`: the prototype inherits from `Error.prototype`, and its `name` is the class's |
| `configurable` | `true` makes the native properties configurable |
Expand All @@ -662,6 +663,7 @@ is collected, make the class [`refCounted`](#refcounted).
| `estimatedSize` | [`fn estimated_size(&self) -> usize`](#memory), for the GC |
| `construct` | `new Name(..)`. Without it JavaScript cannot make one; Rust can, with `payload.into_js(heap)`. |
| `call` | `Name(..)` without `new`, which otherwise throws. It is `fn call(..)`, with no receiver. |
| `callInstance` | `instance(..)`. It is `fn call_instance(&self, ..)`, and `typeof instance` is `"function"`. |
| `internalFields` | JS values the object holds |
| `proto` | properties of the prototype |
| `static` | properties of the constructor: native functions and accessors without `cache` |
Expand Down Expand Up @@ -950,6 +952,28 @@ When the size grows, the member that grew it calls `heap.report_extra_memory(thi
instance, with the class's prototype as its prototype. With `forBind: true`, members are called with
that function as `this`, and `&self` is its `boundThis`. The prototype inherits from `Function.prototype`.

### `protoCaller`

Every `expect()` matcher needs the same work done before and after it. With `protoCaller: "call_matcher"`, calling a
native function of `proto` calls `call_matcher` instead, which receives a pointer to the function:

```rust
pub(crate) fn call_matcher<'a>(
&self,
this_value: JsWrapper<'a, Self>,
cx: &mut JsScope<'a>,
callee: JsLocal<'a>,
arguments: &'a [JsLocal<'a>],
matcher: fn(JsWrapper<'a, Self>, &mut JsScope<'a>, &'a [JsLocal<'a>]) -> JsResult<JSValue>,
) -> JsResult<JSValue> {
matcher(this_value, cx, arguments)
}
```

`callee` is the JS function that was called, and `arguments` is everything it was called with. The function takes its
own arguments out of that list, so they're all `b.any`, the last one possibly `.variadic`. It also needs
`capability: "js"`, `throws: true` and `returns: b.any`, and can't have overloads. The class can't be `refCounted`.

## What the compiler reads

`bun build --compile --aot` knows every native function from one table, which `src/codegen/builtins` generates.
Expand Down
67 changes: 67 additions & 0 deletions docs/runtime/bunfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,47 @@ Same as the top-level `preload` field, but only applies to `bun test`.
preload = ["./setup.ts"]
```

### `test.environment`

The DOM that test files run with. One of `"happy-dom"`, `"jsdom"`, or `"node"` for no DOM. Default `"node"`. A `// @vitest-environment <name>` comment in a test file overrides it. See [DOM testing](/test/dom#test-environments).

```toml title="bunfig.toml" icon="settings"
[test]
environment = "happy-dom"
```

Equivalent CLI flag: `--environment`. It overrides the `bunfig.toml` value.

### `test.globals`

Which module `test`, `expect` and the other globals come from. Default `"bun"`.

- `"bun"`: a file that imports anything from `"vitest"` gets them from `"vitest"`. Any other file gets them from `"bun:test"`.
- `"vitest"`: every file gets them from `"vitest"`, like `globals: true` in a Vitest project.

```toml title="bunfig.toml" icon="settings"
[test]
globals = "vitest"
```

Equivalent CLI flag: `--globals`. It overrides the `bunfig.toml` value.

### `test.reactCompiler`

Compile components and hooks with Bun's built-in React Compiler. Default `false`. Experimental.

- `true`: every JavaScript and TypeScript file, except test files, preload scripts and `node_modules`.
- An array of folders or glob patterns: only the files in them.
- A table with `include` and `exclude`: the files that `include` matches and `exclude` doesn't.

```toml title="bunfig.toml" icon="settings"
[test.reactCompiler]
include = ["src", "packages/ui"]
exclude = ["**/*.stories.*"]
```

Equivalent CLI flag: `--react-compiler`. See [React Compiler](/test/configuration#react-compiler).

### `test.pathIgnorePatterns`

Exclude files and directories from test discovery using glob patterns. The test runner prunes matched directories during scanning, so it never traverses their contents. Use this when your project contains submodules or vendored code with `*.test.ts` files that you don't want `bun test` to pick up.
Expand Down Expand Up @@ -346,6 +387,17 @@ retry = 3

The `--retry` CLI flag overrides this setting.

### `test.clearMocks`

Clear every mock function's calls and results before each test. Default `false`, or `true` for tests that use `test` from `"vitest"`.

```toml title="bunfig.toml" icon="settings"
[test]
clearMocks = true
```

`mockReset`, `restoreMocks`, `unstubEnvs` and `unstubGlobals` work the same way. They call `vi.resetAllMocks()`, `vi.restoreAllMocks()`, `vi.unstubAllEnvs()` and `vi.unstubAllGlobals()` before each test. Default `false`.

### `test.concurrentTestGlob`

Test files matching this glob pattern run all of their tests concurrently, as if you passed the `--concurrent` flag.
Expand Down Expand Up @@ -394,6 +446,21 @@ junit = "test-results.xml"

CI systems and other tools can consume the report.

#### `test.reporter.junitSuites`

How the JUnit report represents `describe` blocks. Default `"nested"`.

- `"nested"`: each block gets its own `<testsuite>` inside its file's `<testsuite>`.
- `"flat"`: each file gets one `<testsuite>`, and each test's name is prefixed with the names of its blocks.

```toml title="bunfig.toml" icon="settings"
[test.reporter]
junit = "test-results.xml"
junitSuites = "flat"
```

Equivalent to the `--reporter-junit-suites` flag.

## Linter

The `[lint]` section configures [`bun lint`](/lint). Run `bun lint --init` to add it.
Expand Down
2 changes: 2 additions & 0 deletions docs/runtime/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ Bun.env.API_TOKEN; // => "secret"
import.meta.env.API_TOKEN; // => "secret"
```

In `bun test`, `import.meta.env` also has [Vite's `MODE`, `DEV`, `PROD`, `SSR` and `BASE_URL`](/test/runtime-behavior#import-meta-env).

To print all currently-set environment variables, run `bun --print process.env`.

```sh
Expand Down
10 changes: 10 additions & 0 deletions docs/runtime/file-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,16 @@ import "./styles.css";

The import returns no value; it's only used for its side effects.

Importing a [CSS module](/bundler/css#css-modules) (`.module.css`) returns an object that maps each class name to its unique identifier. This works in the bundler and at runtime (`bun run`, `bun test`).

```ts
import styles from "./styles.module.css";

console.log(styles.button); // "button_123"
```

At runtime, CSS that the bundler would reject doesn't fail the import. Invalid rules and declarations are skipped, like in a browser.

### `sh` loader

**Bun Shell loader**. Default for `.sh` files
Expand Down
2 changes: 1 addition & 1 deletion docs/runtime/module-graph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Run many instances of one app in a single process with Bun.ModuleGr

<Warning>`Bun.ModuleGraph` is experimental.</Warning>

A `Bun.ModuleGraph` loads modules into the current global another time. Each graph has its own module instances, its own `require.cache`, and its own values for the names you pass as `globals`. Parsed code and bytecode are shared between graphs; ES modules share JIT-compiled code too. The first module a graph `import()`s is that graph's main module: `import.meta.main` and `require.main === module` are true in it, and in no other module of the graph.
A `Bun.ModuleGraph` loads modules into the current global another time. Each graph has its own module instances, its own `require.cache`, and its own values for the names you pass as `globals`. Parsed code, bytecode and JIT-compiled code are shared between graphs, for as long as a graph that ran the code is reachable. The first module a graph `import()`s is that graph's main module: `import.meta.main` and `require.main === module` are true in it, and in no other module of the graph.

```ts host.ts icon="/icons/typescript.svg"
// A `process` of the tenant's own: its module code sees this one.
Expand Down
Loading
Loading