Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

vitest

> 测试质量
Open source

Next generation testing framework powered by Vite.

16.9K stars0 likes8 views
WebsiteGitHub

About

Next generation testing framework powered by Vite.



</picture>



Vitest

Next generation testing framework powered by Vite.

Get involved!

Documentation | Getting Started | Examples | Why Vitest?

中文文档



Features

  • Vite's config, transformers, resolvers, and plugins. Use the same setup from your app!
  • Jest Snapshot
  • Chai built-in for assertions, with Jest expect compatible APIs
  • Smart & instant watch mode, like HMR for tests!
  • Native code coverage via v8 or istanbul.
  • Jest-compatible mocking, stubbing, and spies.
  • JSDOM and happy-dom for DOM and browser API mocking
  • Browser Mode for running component tests in the browser
  • Components testing (Vue, React, Svelte, Lit, Marko)
  • Benchmarking support with Tinybench
  • Projects support
  • expect-type for type-level testing
  • ESM first, top level await
  • Out-of-box TypeScript / JSX support
  • Filtering, timeouts, concurrent for suite and tests
  • Sharding support
  • Reporting Uncaught Errors
  • Run your tests in the browser natively

Vitest requires Vite >=v6.4.0 and Node >=v22.12.0

typescript
import { assert, describe, expect, it } from 'vitest'

describe('suite name', () => {
  it('foo', () => {
    expect(1 + 1).toEqual(2)
    expect(true).to.be.true
  })

  it('bar', () => {
    assert.equal(Math.sqrt(4), 2)
  })

  it('snapshot', () => {
    expect({ foo: 'bar' }).toMatchSnapshot()
  })
})
bash
$ npx vitest

Sponsors

Credits

Thanks to:

  • The Jest team and community for creating a delightful testing API
  • @lukeed for the work on uvu where we are inspired a lot from.
  • @pi0 for the idea and implementation of using Vite to transform and bundle the server code.
  • The Vite team for brainstorming the initial idea.
  • @patak-dev for the awesome package name!

Contribution

See Contributing Guide.

License

MIT License © 2021-Present VoidZero Inc. and Vitest contributors

Issues· 419 open

View all issuesOpen on GitHub
  • #11436

    FOSS vulnerability scans identify dependency `convert-source-map` as not maintained / abandoned

    enhancement: pending triageUpdated Oct 1, 2026
  • #957

    Dependency Dashboard

    Updated Oct 1, 2026
  • #11433

    Coverage: covered files with `(` or `[` in their path are re-processed as uncovered, and istanbul can record another module's coverage for an uncovered file

    pending triageUpdated Oct 1, 2026
  • #11434

    browser-playwright: failure screenshot fails with strict mode violation when there are 2 `<body>` elements

    pending triageUpdated Oct 1, 2026
  • #8554

    HMR overlay captures test clicks and cannot be disabled

    feat: browserpending triageUpdated Oct 1, 2026
  • #11431

    Timeout during test context setup makes all retries fail

    pending triageUpdated Oct 1, 2026
  • #11423

    isolate: false: `test.env` is no longer reapplied before each file in a reused worker (regression from 4.1.11)

    Updated Oct 1, 2026
  • #9763

    Optimize html reporter module graph data

    p3-minor-bugfeat: reportersUpdated Oct 1, 2026
  • #11269

    Make `.vitest` artifact directory configurable

    p2-nice-to-havep2-to-be-discussedfeat: reportersUpdated Sep 30, 2026
  • #11243

    Browser mode hangs for ever when a test iframe never fires `load`

    feat: browserp3-minor-bugUpdated Sep 30, 2026

> Tags

TypeScripttesttesting-toolsvite

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category测试质量
PricingOpen source

> Related tools

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.