testing-vitest — for Claude Code testing-vitest, platform-hono, community, for Claude Code, ide skills, bun run test, bun run test:coverage, bun run test:integration, bun run typecheck, bun run check

v1.0.0

关于此技能

适用场景: repository test setup. 本地化技能摘要: ## Repository Test Setup This package uses Bun and Vitest 4. Claude Code, Cursor, and Windsurf workflows.

功能特性

Repository Test Setup
This package uses Bun and Vitest 4.
Unit tests run with bun run test.
Coverage runs with bun run test:coverage.
Integration tests run with bun run test:integration.

# 核心主题

Mnigos Mnigos
[1]
[0]
更新于: 5/3/2026

技能概览

先看适用场景、限制条件和安装路径,再决定是否继续深入。

适用场景: repository test setup. 本地化技能摘要: ## Repository Test Setup This package uses Bun and Vitest 4. Claude Code, Cursor, and Windsurf workflows.

核心价值

推荐说明: testing-vitest helps agents repository test setup. Repository Test Setup This package uses Bun and Vitest 4. Claude Code, Cursor, and Windsurf workflows.

适用 Agent 类型

适用场景: repository test setup.

赋予的主要能力 · testing-vitest

适用任务: Repository Test Setup
适用任务: This package uses Bun and Vitest 4
适用任务: Unit tests run with bun run test

! 使用限制与门槛

  • 限制说明: Vitest globals are enabled. Do not import describe, test, expect, vi, or hooks from vitest.
  • 限制说明: Assert inline when there is only one meaningful assertion against the value.
  • 限制说明: Use a named value only when it improves readability or supports multiple assertions.

关于来源内容

The section below is adapted from the upstream repository. Use it as supporting material alongside the fit, use-case, and installation summary on this page.

实验室 Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

常见问题与安装步骤

以下问题与步骤与页面结构化数据保持一致,便于搜索引擎理解页面内容。

? FAQ

testing-vitest 是什么?

适用场景: repository test setup. 本地化技能摘要: ## Repository Test Setup This package uses Bun and Vitest 4. Claude Code, Cursor, and Windsurf workflows.

如何安装 testing-vitest?

运行命令:npx killer-skills add Mnigos/platform-hono。支持 Cursor、Windsurf、VS Code、Claude Code 等 19+ IDE/Agent。

testing-vitest 适用于哪些场景?

典型场景包括:适用任务: Repository Test Setup、适用任务: This package uses Bun and Vitest 4、适用任务: Unit tests run with bun run test。

testing-vitest 支持哪些 IDE 或 Agent?

该技能兼容 Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer。可使用 Killer-Skills CLI 一条命令通用安装。

testing-vitest 有哪些限制?

限制说明: Vitest globals are enabled. Do not import describe, test, expect, vi, or hooks from vitest.;限制说明: Assert inline when there is only one meaningful assertion against the value.;限制说明: Use a named value only when it improves readability or supports multiple assertions.。

安装步骤

  1. 1. 打开终端

    在你的项目目录中打开终端或命令行。

  2. 2. 执行安装命令

    运行:npx killer-skills add Mnigos/platform-hono。CLI 会自动识别 IDE 或 AI Agent 并完成配置。

  3. 3. 开始使用技能

    testing-vitest 已启用,可立即在当前项目中调用。

! 来源说明

此页面仍可作为安装与查阅参考。继续使用前,请结合上方适用场景、限制条件和上游仓库说明一起判断。

Upstream Repository Material

The section below is adapted from the upstream repository. Use it as supporting material alongside the fit, use-case, and installation summary on this page.

Upstream Source

testing-vitest

安装 testing-vitest,这是一款面向AI agent workflows and automation的 AI Agent Skill。查看功能、使用场景、限制条件与安装命令。

SKILL.md
Readonly
Upstream Repository Material
The section below is adapted from the upstream repository. Use it as supporting material alongside the fit, use-case, and installation summary on this page.
Upstream Source

Repository Test Setup

This package uses Bun and Vitest 4.

  • Unit tests run with bun run test.
  • Coverage runs with bun run test:coverage.
  • Integration tests run with bun run test:integration.
  • Type checking runs with bun run typecheck.
  • Formatting/linting runs with bun run check or bun run check:fix.

vitest.config.ts excludes tests/integration/**/*.integration.spec.ts. vitest.integration.config.ts includes only tests/integration/**/*.integration.spec.ts, disables file parallelism, and uses one worker.

Vitest Globals

Vitest globals are enabled. Do not import describe, test, expect, vi, or hooks from vitest.

typescript
1// Wrong - unnecessary imports 2import { describe, expect, test, vi } from 'vitest'

Use test, not it.

Test Placement

  • Put focused unit tests near the behavior they exercise, using *.spec.ts.
  • Put tests that boot a server, bind ports, or exercise full request flow under tests/integration/**/*.integration.spec.ts.
  • Prefer testing exported behavior from src/index.ts or public module exports. Reach into internal files only when the behavior is intentionally internal and difficult to verify through the public adapter.

Spy Naming

Name spies after the method, suffixed with Spy.

typescript
1const warnSpy = vi.spyOn(Logger.prototype, 'warn').mockImplementation(() => {}) 2const jsonSpy = vi.spyOn(ctx, 'json').mockReturnValue(response) 3 4// Wrong - generic name 5const spy = vi.spyOn(Logger.prototype, 'warn')

Set up vi.spyOn() before calling the function under test.

Assertions

Assert inline when there is only one meaningful assertion against the value.

typescript
1expect(await adapter.reply(ctx, { ok: true })).toBeUndefined()

Use a named value only when it improves readability or supports multiple assertions.

typescript
1const response = await app.request('/health') 2 3expect(response.status).toBe(200) 4await expect(response.json()).resolves.toEqual({ ok: true })

Error Testing

Use .rejects or .toThrow, not try/catch.

typescript
1await expect(adapter.reply(ctx, body)).rejects.toBeInstanceOf(Error) 2expect(() => adapter.render()).toThrow('Method not implemented.')

For multiple async error assertions, store the promise.

typescript
1const promise = adapter.reply(ctx, body) 2 3await expect(promise).rejects.toBeInstanceOf(Error) 4await expect(promise).rejects.toMatchObject({ message: 'boom' })

Mock Placement

Always put imports first. Write vi.mock(...) after imports, even though Vitest hoists mock calls.

Do not declare mock variables above imports. Prefer inline mock factories and assert through the mocked import.

typescript
1import { serveStatic } from '@hono/node-server/serve-static' 2 3vi.mock('@hono/node-server/serve-static', () => ({ 4 serveStatic: vi.fn() 5})) 6 7vi.mocked(serveStatic).mockReturnValue(async () => undefined)

Hono Adapter Tests

Prefer real Hono requests for route behavior.

typescript
1const adapter = new HonoAdapter() 2 3adapter.get('/hello', (_req, ctx) => { 4 return ctx.text('hello') 5}) 6 7const response = await adapter.hono.request('/hello') 8 9expect(response.status).toBe(200) 10await expect(response.text()).resolves.toBe('hello')

For behavior that depends on Nest abstractions, use the smallest fake Context or request object needed. Keep the fake local to the spec unless the same shape repeats across multiple files.

Cleanup

Use afterEach for mock cleanup.

typescript
1afterEach(() => { 2 vi.restoreAllMocks() 3})

Use vi.clearAllMocks() only when keeping the same mocked implementations matters. Close any servers started in integration tests.

TypeScript Style In Tests

Follow the repository rules:

  • Do not add explicit function or method return type annotations unless they are strictly needed.
  • Prefer interfaces over type aliases for object shapes.
  • Avoid any; test files allow it, but use unknown, narrow fakes, or imported types when reasonable.
  • Match existing Biome formatting: tabs, single quotes, no semicolons.

Anti-Patterns

  • Importing Vitest globals.
  • Using it instead of test.
  • Generic spy names such as const spy = ....
  • Creating spies after the code under test has already run.
  • try/catch for error testing.
  • Over-building Nest testing modules for behavior that can be tested with the adapter or Hono directly.
  • Leaving bound servers open in integration tests.
  • Adding return type annotations just because a function is exported.

Verification

bash
1bun run test 2bun run test:integration 3bun run typecheck 4bun run check

相关技能

寻找 testing-vitest 的替代方案 (Alternative) 或可搭配使用的同类 community Skill?探索以下相关开源技能。

查看全部

openclaw-release-maintainer

Logo of openclaw
openclaw

本地化技能摘要: 🦞 # OpenClaw Release Maintainer Use this skill for release and publish-time workflow. It covers ai, assistant, crustacean workflows. Claude Code, Cursor, and Windsurf workflows.

333.8k
0
AI

widget-generator

Logo of f
f

本地化技能摘要: Generate customizable widget plugins for the prompts.chat feed system # Widget Generator Skill This skill guides creation of widget plugins for prompts.chat. It covers ai, artificial-intelligence, awesome-list workflows. Claude Code, Cursor, and Windsurf

149.6k
0
AI

flags

Logo of vercel
vercel

本地化技能摘要: The React Framework # Feature Flags Use this skill when adding or changing framework feature flags in Next.js internals. It covers blog, browser, compiler workflows. Claude Code, Cursor, and Windsurf workflows.

138.4k
0
浏览器

pr-review

Logo of pytorch
pytorch

本地化技能摘要: Usage Modes No Argument If the user invokes /pr-review with no arguments, do not perform a review. It covers autograd, deep-learning, gpu workflows. Claude Code, Cursor, and Windsurf workflows.

98.6k
0
开发者工具