Vitest

A blazing-fast unit testing framework powered by Vite, with Jest-compatible APIs out of the box.

Tool
npm
v5.0.2
17,166 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
93 /100 Excellent
Development Activity 100
Maintenance 100
Community 76
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
89 /100 Excellent
Architecture 88
Code Quality 90
Innovation 88
Learning Curve 90

Vitest is a next-generation testing framework built directly on Vite’s transform pipeline, so test files run through the exact same config, plugins, and module resolution as your application code. It ships a Jest-compatible API (describe, it, expect, vi.fn) backed by Chai assertions, meaning most existing suites port over with little to no rewriting. Beyond unit tests, Vitest bundles native code coverage, in-source testing, TypeScript type-checking as a test mode, benchmarking via Tinybench, and a real Browser Mode for running DOM/component tests inside actual browsers rather than a simulated environment.

What You Get

  • A Jest-compatible API (describe, it, expect, vi.fn) with Chai assertions under the hood, so most existing test suites port over with minimal changes
  • Instant, HMR-like watch mode that only reruns tests affected by a changed module
  • Native code coverage via V8 or Istanbul, plus in-source testing and TypeScript type-checking as a first-class test mode
  • A real Browser Mode for running component and DOM tests inside actual browsers via Playwright, Preview, or WebdriverIO
  • Built-in workspace/projects support to run multiple test configurations (unit, browser, e2e) from one CLI invocation

Common Use Cases

  • Unit and integration testing for Vite-based frontend apps (Vue, React, Svelte, Solid) that want zero extra config
  • Migrating an existing Jest test suite to a faster, ESM-native runner without rewriting test syntax
  • Component testing in a real browser environment via Vitest Browser Mode instead of a simulated DOM
  • Benchmarking hot code paths with the built-in Tinybench-powered bench() API alongside regular tests

Under The Hood

Architecture - Vitest’s core lives in packages/vitest/src, split into node/ (the orchestrator: config resolution, per-project management via TestProject, process pools in node/pools, reporters, and coverage-provider wiring) and runtime/ (test execution: runners that execute suites inside worker or VM contexts using a moduleRunner/moduleEvaluator to instrument ESM modules). The monorepo’s packages/ directory holds 14 sibling packages — @vitest/expect (assertions), @vitest/mocker, @vitest/snapshot, @vitest/spy, @vitest/pretty-format, @vitest/utils, @vitest/browser plus browser-playwright/browser-preview (Browser Mode), coverage-istanbul/coverage-v8, @vitest/ui, and web-worker. The CLI entry (vitest.mjs) drives node/cli, which builds a Vitest instance (core.ts) that attaches a Vite dev server, creates a ModuleRunner per project, and schedules test files across worker pools, streaming results back through a Report abstraction to pluggable reporters. Multi-project support (node/projects, TestProject) lets one config fan out to multiple named test projects or workspaces.

Tech Stack - The codebase is 95%+ TypeScript, built with Rollup (plus rollup-plugin-dts and unplugin-isolated-decl/unplugin-oxc for isolated declaration emission) across a pnpm workspace that uses catalog: version pinning for shared dependencies. Runtime dependencies include Chai for assertions, Tinybench for benchmarking, and the team’s own tinyexec/tinyglobby/tinyrainbow utility family, alongside es-module-lexer and magic-string for source transforms and picomatch for glob filtering. Vite itself is a peer dependency (^6.4.0 || ^7.0.0 || ^8.0.0), and optional peers cover browser automation, V8/Istanbul coverage, and OpenTelemetry tracing. Node engines require ^22.12.0, ^24.0.0, or >=26.0.0, reflecting an ESM-first, modern-Node-only design.

Code Quality - The monorepo contains 946 test/spec files across a dedicated test/ tree (unit, browser, e2e, node-runner, workspaces, typescript, ui, test-utils) and dogfoods itself — its own CI runs Vitest’s unit suite via pnpm’s own test pipeline. Sampled core files (e.g. node/core.ts) show consistent use of import type separated from value imports, descriptive naming, and centralized typed error handling (a dedicated errors.ts with types like FilesNotFoundError). CI enforces typecheck, lint, build, and the full test suite before merge, and a 16KB+ CONTRIBUTING.md documents workspace layout and testing conventions in depth.

API Design - Vitest’s public API is deliberately Jest-compatible (describe/it/expect/vi.fn mirror Jest’s shape), minimizing migration friction while adding native ESM, top-level await, and TypeScript support without extra transpilation config. Zero-config startup for Vite-based projects is a strong DX win since it can reuse an existing vite.config.ts. The package.json exports map is intricate (separate subpaths for /browser, /config, /node, /runtime, /worker, plus internal-only entries), giving power users fine control at the cost of extra surface area for newcomers. Documentation is extensive — 130+ markdown files under docs/ across guide/config/api/blog sections, plus 8 example projects (basic, fastify, lit, opentelemetry, profiling, projects, typecheck, in-source-test).

Used by 467 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

166

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
31
Repo Health
70
Technical
64
Dependency
Built with
TypeScript 76%
MDX 18%
Updated 1 years ago
TypeScript
100%
Other

Activepieces

AI Assistants · Automation · Mcp

24,756

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
64
Dependency
Built with
TypeScript 100%
Updated 5 days ago
TypeScript
95%
MIT

Actual

Invoicing Finance

29,186

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 95%
Updated 5 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 6 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 6 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 6 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 6 days ago
Python
67%
Apache 2.0

Agent Control

AI Agents

314

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
74
Repo Health
71
Technical
67
Dependency
Built with
Python 67%
TypeScript 32%
Updated 5 days ago
Python
99%
MIT

Agent Lightning

AI Development

18,515

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
85
Repo Health
68
Technical
69
Dependency
Built with
Python 99%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers