Gutenberg’s JavaScript unit and integration tests now use Vitest

TL;DR

Gutenberg’s JavaScript unit and integration tests now use Vitest, bringing better support for modern JavaScript modules and real-browser component testing.
Tests explicitly import Vitest APIs. Filenames select Node, jsdom, or Browser Mode according to what each test needs.
@wordpress/scripts 36.0.0 makes Vitest the default for test-unit-js. Projects install and configure their own test runner.
Existing projects can keep their Jest tests through test-unit-jest, after a one-time setup update. This command receives maintenance support and has no scheduled removal.
@wordpress/jest-preset-default and @wordpress/jest-console are deprecated. Published versions remain available for existing projects. No replacement WordPress Vitest preset or console packages are planned.

Following the initial announcement in #core-editor, Gutenberg has completed its migration from Jest to Vitest for JavaScript unit and integration tests.

This post was originally published on Make Core by Marco Ciampini.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.