📦vitest-dev / vitest
← 返回首页
Next generation testing framework powered by Vite.
⚖️ MIT#vite#test#testing-tools🌐 vitest.dev📅 创建于 2021-12-03🔄 更新于 2026-10-29
🔗 GitHub TypeScript

📄 仓库 README

在 GitHub 查看 ↗
来自 GitHub 仓库自述文件 · 版权归原作者所有



Vitest logo


Vitest

Next generation testing framework powered by Vite.

current vitest version badge

Get involved!

Documentation | Getting Started | Examples | Why Vitest?

中文文档



## Features - [Vite](https://vitejs.dev/)'s config, transformers, resolvers, and plugins. Use the same setup from your app! - [Jest Snapshot](https://jestjs.io/docs/snapshot-testing) - [Chai](https://www.chaijs.com/) built-in for assertions, with [Jest expect](https://jestjs.io/docs/expect) compatible APIs - [Smart & instant watch mode](https://vitest.dev/guide/features.html#watch-mode), like HMR for tests! - [Native code coverage](https://vitest.dev/guide/features.html#coverage) via [`v8`](https://v8.dev/blog/javascript-code-coverage) or [`istanbul`](https://istanbul.js.org/). - Jest-compatible mocking, stubbing, and spies. - [JSDOM](https://github.com/jsdom/jsdom) and [happy-dom](https://github.com/capricorn86/happy-dom) for DOM and browser API mocking - [Browser Mode](https://vitest.dev/guide/browser/) for running component tests in the browser - Components testing ([Vue](https://github.com/vitest-tests/browser-examples/tree/main/examples/vue), [React](https://github.com/vitest-tests/browser-examples/tree/main/examples/react), [Svelte](https://github.com/vitest-tests/browser-examples/tree/main/examples/svelte), [Lit](https://github.com/vitest-dev/vitest/blob/HEAD/./examples/lit), [Marko](https://github.com/marko-js/examples/tree/master/examples/library-ts)) - Benchmarking support with [Tinybench](https://github.com/tinylibs/tinybench) - [Projects](https://vitest.dev/guide/projects) support - [expect-type](https://github.com/mmkal/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
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()
  })
})
$ npx vitest
## Sponsors

vitest's sponsors

## Credits Thanks to: - [The Jest team and community](https://jestjs.io/) for creating a delightful testing API - [@lukeed](https://github.com/lukeed) for the work on [uvu](https://github.com/lukeed/uvu) where we are inspired a lot from. - [@pi0](https://github.com/pi0) for the idea and implementation of using Vite to transform and bundle the server code. - [The Vite team](https://github.com/vitejs/vite) for brainstorming the initial idea. - [@patak-dev](https://github.com/patak-dev) for the awesome package name! ## Contribution See [Contributing Guide](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md). ## License [MIT](https://github.com/vitest-dev/vitest/blob/HEAD/./LICENSE) License © 2021-Present VoidZero Inc. and Vitest contributors

📈 近 7 天 Star 趋势

每日新增 Star(柱)与累计 Star(线)· 数据来自 GitHub

🏆 排名变化趋势

在各榜单中的排名历史(数字越小越靠前)

📋 历史上榜记录

每次快照的详细数据
日期 榜单 排名 周期新增 总 STAR