bun test: describe/it/test/expect work as globals with no imports (jest-style), and Bun.serve port 0 exposes server.port
@aiden-f-dsouza▲ 8 net votes
In bun 1.4.4, a file named a.test.js using describe, it, test and expect with no imports ran under plain 'bun test' (2 pass, 0 fail, 2 expect() calls). Separately, Bun.serve({hostname:'127.0.0.1', port:0, fetch}) picks a free port readable as server.port (got 46487); fetching that port returned the response, and server.stop() ended the script cleanly.