{"id":196,"date":"2026-11-18T10:29:44","date_gmt":"2026-11-18T10:29:44","guid":{"rendered":"https:\/\/blockoala.com\/index.php\/2026\/11\/18\/vitest-5-prioritizes-speed-and-tightens-test-behavior\/"},"modified":"2026-11-18T10:29:44","modified_gmt":"2026-11-18T10:29:44","slug":"vitest-5-prioritizes-speed-and-tightens-test-behavior","status":"publish","type":"post","link":"https:\/\/blockoala.com\/index.php\/2026\/11\/18\/vitest-5-prioritizes-speed-and-tightens-test-behavior\/","title":{"rendered":"Vitest 5 prioritizes speed and tightens test behavior"},"content":{"rendered":"<p>As reported on November 17, 2026, VoidZero released Vitest 5.0 with a focus on faster test runs and changes to defaults that may require updates to existing suites.<\/p>\n<p>In benchmarks spanning a five-file utility package to a monolithic application with 1,280 modules, the Vitest team reported performance gains of about 8% to 25% in most configurations and up to 53% with VM pools. VoidZero also said overall performance, including browser mode, improved by about 18%. The reported gains come from inline projects sharing a Vite server, a now-stable disk <code>fsModuleCache<\/code>, fewer round trips between the main process and workers, and VM pools that can reuse compiled code. A new <code>vitest doctor<\/code> command reruns a suite under different configurations and suggests faster options.<\/p>\n<p>Browser mode adds Trace View, which records interactions and assertions as DOM snapshots for step-by-step replay. The new <code>vi.when<\/code> API lets a single listener return different values for different arguments.<\/p>\n<p>Several changes could affect existing tests: <code>clearMocks<\/code> now defaults to <code>true<\/code>; asynchronous assertions without <code>await<\/code> fail rather than warn; hoisted <code>vi.mock<\/code> calls outside the top-level scope throw errors; and <code>toThrow('')<\/code> now matches any error. OpenReplay noted that most of these changes expose already-invalid test code, but warned that suites relying on mock history leaking between tests could fail in CI despite passing locally under Vitest 4.<\/p>\n<p>Vitest 5 requires Vite 6.4 and Node.js 22.12 or later. Yarn users must install Vite separately because it is now a peer dependency. Reports, attachments and blob reports have moved to <code>.vitest\/<\/code>, so CI artifact paths may need updating. Ecosystem compatibility work was still underway: an issue report for Cloudflare\u2019s <code>vitest-pool-workers<\/code> said its peer-dependency range was pinned to Vitest 4, which could prevent affected projects from running tests after upgrading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As reported on November 17, 2026, VoidZero released Vitest 5.0 with a focus on faster test runs and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-196","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/comments?post=196"}],"version-history":[{"count":0,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/posts\/196\/revisions"}],"wp:attachment":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/media?parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/categories?post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/tags?post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}