Skip to content

Vitest 3.0 is out!

January 17, 2025

Vitest 3 Announcement Cover Image

We released Vitest 2 half a year ago. We have seen huge adoption, from 4,8M to 7,7M weekly npm downloads. Our ecosystem is growing rapidly too. Among others, Storybook new testing capabilities powered by our vscode extension and browser mode and Matt Pocock is building Evalite, a tool for evaluating AI-powered apps, on top of Vitest.

The next Vitest major is here

Today, we are thrilled to announce Vitest 3! This is a big one!

Quick links:

If you've not used Vitest before, we suggest reading the Getting Started and Features guides first.

We extend our gratitude to the over 550 contributors to Vitest Core and to the maintainers and contributors of Vitest integrations, tools, and translations who have helped us develop this new major release. We encourage you to get involved and help us improve Vitest for the entire ecosystem. Learn more at our Contributing Guide.

To get started, we suggest helping triage issues, review PRs, send failing tests PRs based on open issues, and support others in Discussions and Vitest Land's help forum. If you'd like to talk to us, join our Discord community and say hi on the #contributing channel.

For the latest news about the Vitest ecosystem and Vitest core, follow us on Bluesky or Mastodon.

Reporter Updates

@AriPerkkio rewrote how Vitest reports the test run. You should see less flicker and more stable output!

Alongside this change, we also redesign the public reporter API (the reporters field) making the lifecycle easier to understand.

You can follow the design process in #7069 PR. It was a hard fight trying to reverse-engineer the previous onTaskUpdate API to make this new elegant lifecycle possible.

Inline Workspace

Rejoice! No more separate files to define your workspace - specify an array of projects using the workspace field in your vitest.config file:

jsx
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    workspace: ['packages/*'],
  },
})

Multi-Browser Configuration

Vitest 3 introduces a more performant way to run your browser tests in different browsers or setups. Instead of using the workspace, you can define an array of instances to run your browser tests in different setups:

jsx
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    browser: {
      provider: 'playwright',
      instances: [
        {
          browser: 'chromium',
          launch: { devtools: true },
        },
        {
          browser: 'firefox',
          setupFiles: ['./setup.firefox.ts'],
          provide: {
            secret: 'my-secret',
          },
        },
      ],
    }
  }
})

The main advantage of instances over workspace is a better caching strategy - Vitest creates only a single Vite server to serve files, which are processed only once, independent of how many browsers you test.

This release also improves the documentation of Browser Mode features and introduces separate guides for Playwright and WebdriverIO hopefully making it easier to configure.

Filtering by Location

In Vitest 3 you can now filter tests by line number.

$ vitest basic/foo.js:10
$ vitest ./basic/foo.js:10

A big shutout to @mzhubail for implementing this feature.

Public API

We have redesigned the public API available from vitest/node and are planning to remove the experimental tag in the next minor version. This release also includes brand new documentation covering all exposed methods.

Vitest API documentationVitest API documentation

Breaking changes

Vitest 3 has a few small breaking changes that should not affect most users, but we advise reviewing the detailed Migration Guide before upgrading.

The complete list of changes is at the Vitest 3 Changelog.

Acknowledgments

Vitest 3 is the result of countless hours by the Vitest team and our contributors. We appreciate the individuals and companies sponsoring Vitest development. Vladimir and Hiroshi joined VoidZero to work on Vite and Vitest full-time, and StackBlitz hired Ari to invest more time in Vitest development. A shout-out to NuxtLabs, Zammad, and sponsors on Vitest's GitHub Sponsors and Vitest's Open Collective.

Released under the MIT License.