mcpField
V
Vitest

Vitest

OfficialAgent-ready
github.comDeveloper Tools17.3kvitestUpdated today
RepositoryVisit website

About Vitest

Vitest is a unit testing framework designed for the Vite ecosystem, offering a Jest-compatible API. It supports modern JavaScript features, snapshot testing, and TypeScript, and integrates with the Vite development server for rapid feedback. Coding agents and development teams use it to automate and accelerate test workflows.

Key features

  1. 01Run unit tests with a Jest-compatible API
  2. 02Support snapshot testing, mocking, and code coverage analysis
  3. 03Seamless integration with Vite development server for fast feedback

Use cases

  1. 01Verify code logic in modern JavaScript projects
  2. 02Automate testing in CI/CD pipelines and coding agents

Install

Pick your OS or package manager and run the command in a terminal.

$
npm install -D vitest

Once installed, runvitest --versionto confirm it works.

Example commands

Common commands in the order you’d use them.

01
npx vitest
02
npx vitest run

Details

From the project README



Vitest logo


Vitest

Next generation testing framework powered by Vite.

current vitest version badge

Get involved!

Documentation | Getting Started | Examples | Why Vitest?

中文文档



Features

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:

Contribution

See Contributing Guide.

License

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

Comments

Markdown supported