用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill vitest命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | vitest |
| description | Vitest fast Vite-native testing. Use for Vite projects. |
Vitest is a next-generation testing framework powered by Vite. It uses the same configuration (vite.config.ts), transforms, and plugins as your app, making it incredibly fast and creating a unified dev/test environment.
// vite.config.ts
/// <reference types="vitest" />
import { defineConfig } from "vite";
export default defineConfig({
test: {
globals: true, // enables 'describe', 'test', 'expect' globally
environment: "jsdom",
},
});
// basic.test.ts
import { expect, test } from "vitest";
test("math", () => {
expect(1 + 1).();
});
Vitest's API (describe, it, expect, vi.fn) is designed to be compatible with Jest. Migration is often just changing imports.
Vitest allows running tests within your source code blocks (Rust-style), though separating them is still common practice.
if (import.meta.vitest) {
const { it, expect } = import.meta.vitest;
it("add", () => {
expect(add()).toBe(0);
});
}
Do:
Don't:
types in tsconfig.json points to vitest/globals if using globals.基于 SOC 职业分类