登录 注册
开发者工具 testtesting-toolsvite
17,366
Stars
2,150
Forks
58
Watchers
366
Open Issues
MIT
许可证
TypeScript
语言
2021-12-03
创建时间
2026-11-11
最近更新

项目能做什么

由 Vite 驱动的下一代前端测试框架。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<p align="center">
  <br>
  <br>
  <a href="https://vitest.dev" target="_blank" rel="noopener noreferrer">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://vitest.dev/vitest-light.svg">
      <source media="(prefers-color-scheme: light)" srcset="https://vitest.dev/vitest-dark.svg">
      <img alt="Vitest logo" src="https://vitest.dev/vitest-dark.svg" height="60">
    </picture>
  </a>
  <br>
  <br>
  <br>
</p>

<h1 align="center">
Vitest
</h1>
<p align="center">
Next generation testing framework powered by Vite.
<p>
<p align="center">
  <a href="https://npmx.dev/package/vitest"><img src="https://img.shields.io/npm/v/vitest?color=729B1B&label=" alt="current vitest version badge"></a>
<p>

<p align="center">
<a href="https://chat.vitest.dev"><b>Get involved!</b></a>
</p>
<p align="center">
 <a href="https://vitest.dev">Documentation</a> | <a href="https://vitest.dev/guide/">Getting Started</a> | <a href="https://vitest.dev/guide/#examples">Examples</a> | <a href="https://vitest.dev/guide/why">Why Vitest?</a>
</p>
<p align="center">
<a href="https://cn.vitest.dev">中文文档</a>
</p>

<h4 align="center">

</h4>
<br>
<br>

## 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](./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

```ts
import { assert, describe, expect, it } from 'vitest'

describe('suite name', () => {
  it('foo', () => {
    expect(1 + 
阅读完整原文

商业机会分析 AI 生成

Vitest 专属 CI/CD 智能分片与分布式云执行服务 (SaaS)

产品构想利用 Vitest 的 Sharding 与 Projects 能力,提供免配置的云端测试并发调度平台,自动分析 Git 变更与历史耗时,将测试拆分到多实例并发执行并合并报告。
核心功能Git 差异感知测试(仅跑受影响测试)、智能耗时均衡分片、分布式测试缓存、统一失败重试与 Flaky Test 标记看板。
目标用户中大型前端/全栈团队、monorepo 项目维护者、CI 构建时间超过15分钟的企业。
难度/周期高 · 3-6个月 · 成本:中等(容器与计算资源、多区域网络基础设施、SaaS 管理后台)
收费模式按测试执行时长/并行并发数订阅制收费(Free + Pro + Enterprise)。
竞争风险已被大型 CI 工具(如 GitHub Actions、Nx Cloud、CircleCI)部分覆盖,需要极高的性能和体验差距才能促成付费转换。
依据 数据支持的判断

Vitest Browser Mode 云端多浏览器兼容测试矩阵

产品构想结合 Vitest 原生 Browser Mode,提供开箱即用的真实浏览器集群(Chromium, Firefox, WebKit 及移动端 Webview)进行无头组件自动化渲染测试与视觉回归。
核心功能多浏览器自动化并发环境拉起、视觉差异比对 (Visual Regression)、DOM 交互录制与复现、与 Vitest CLI/UI 原生打通的插件体系。
目标用户组件库开发者、UI 工程师、跨端 Web 应用企业团队。
难度/周期高 · 4-6个月 · 成本:高(持久化浏览器环境容器、显存及高 IO 资源、存储消耗)
收费模式按浏览器运行机时或按截图比对量阶梯计费。
竞争风险需要与成熟商业平台(BrowserStack, Chromatic, Percy)直接竞争,技术维护复杂度极高。
依据 尚需验证的假设

面向 Vitest 生态的 AI 智能单测生成与补全 CLI 工具

产品构想基于 Vitest + Vite 的代码转换上下文,扫描项目中的 Vue/React/TS 文件,自动生成高质量符合 Vitest 语法(含 mock、expect、快照)的测试用例并自动跑通校验。
核心功能AST 提取与 Vite 模块分析、LLM 生成用例并利用本地 Vitest 实时自测修正、代码覆盖率差额自动填补模式、批量 PR 提交。
目标用户面临测试覆盖率硬性指标的业务团队、外包及企业级系统维护者。
难度/周期中等 · 1-2个月 · 成本:低(LLM API 调用成本、CLI 维护成本)
收费模式商业许可授权或按生成的可用测试用例数量计费(提供私有化部署企业版)。
竞争风险大模型生成的单测容易存在虚假断言,开发者对生成测试的维护信任度可能不足。
依据 AI推测
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
microsoft/playwright 中文介绍暂未生成
Playwright is a framework for Web Testing and Automation. It
99,886 TypeScript
oven-sh/bun 中文介绍暂未生成
Incredibly fast JavaScript runtime, bundler, test runner, an
96,656 Rust
storybookjs/storybook 中文介绍暂未生成
Storybook is the industry standard workshop for building, do
91,533 TypeScript
typicode/json-server 中文介绍暂未生成
Get a full fake REST API with zero coding in less than 30 se
75,739 JavaScript
usestrix/strix 中文介绍暂未生成
Open-source AI penetration testing tool to find and fix your
75,001 Python
localstack/localstack 中文介绍暂未生成
💻 A fully functional local AWS cloud stack. Develop and test
65,120 Python
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2021-12-03,近 30 天仍在推送,发布过 100 个 Release
社区活跃Star 17,366 / Fork 2,150 / Issue 366(数据支持,可自行核实)
许可证MIT
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/vitest-dev/vitest.git
cd vitest
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。