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

À propos de ce Skill

Scenario recommande : Ideal for AI agents that need repository test setup. Resume localise : ## Repository Test Setup This package uses Bun and Vitest 4. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Fonctionnalités

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.

# Sujets clés

Mnigos Mnigos
[1]
[0]
Mis à jour: 5/3/2026

Skill Overview

Start with fit, limitations, and setup before diving into the repository.

Scenario recommande : Ideal for AI agents that need repository test setup. Resume localise : ## Repository Test Setup This package uses Bun and Vitest 4. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Pourquoi utiliser cette compétence

Recommandation : testing-vitest helps agents repository test setup. Repository Test Setup This package uses Bun and Vitest 4. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Meilleur pour

Scenario recommande : Ideal for AI agents that need repository test setup.

Cas d'utilisation exploitables for testing-vitest

Cas d'usage : Applying Repository Test Setup
Cas d'usage : Applying This package uses Bun and Vitest 4
Cas d'usage : Applying Unit tests run with bun run test

! Sécurité et Limitations

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

About The Source

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

Démo Labs

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 et étapes d’installation

These questions and steps mirror the structured data on this page for better search understanding.

? Questions fréquentes

Qu’est-ce que testing-vitest ?

Scenario recommande : Ideal for AI agents that need repository test setup. Resume localise : ## Repository Test Setup This package uses Bun and Vitest 4. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

Comment installer testing-vitest ?

Exécutez la commande : npx killer-skills add Mnigos/platform-hono/testing-vitest. Elle fonctionne avec Cursor, Windsurf, VS Code, Claude Code et plus de 19 autres IDE.

Quels sont les cas d’usage de testing-vitest ?

Les principaux cas d’usage incluent : Cas d'usage : Applying Repository Test Setup, Cas d'usage : Applying This package uses Bun and Vitest 4, Cas d'usage : Applying Unit tests run with bun run test.

Quels IDE sont compatibles avec testing-vitest ?

Cette skill est compatible avec 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. Utilisez la CLI Killer-Skills pour une installation unifiée.

Y a-t-il des limites pour testing-vitest ?

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

Comment installer ce skill

  1. 1. Ouvrir le terminal

    Ouvrez le terminal ou la ligne de commande dans le dossier du projet.

  2. 2. Lancer la commande d’installation

    Exécutez : npx killer-skills add Mnigos/platform-hono/testing-vitest. La CLI détectera automatiquement votre IDE ou votre agent et configurera la skill.

  3. 3. Commencer à utiliser le skill

    Le skill est maintenant actif. Votre agent IA peut utiliser testing-vitest immédiatement dans le projet.

! Source Notes

This page is still useful for installation and source reference. Before using it, compare the fit, limitations, and upstream repository notes above.

Upstream Repository Material

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

Upstream Source

testing-vitest

## Repository Test Setup This package uses Bun and Vitest 4. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows. Repository Test Setup

SKILL.md
Readonly
Upstream Repository Material
The section below comes 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

Compétences associées

Looking for an alternative to testing-vitest or another community skill for your workflow? Explore these related open-source skills.

Voir tout

openclaw-release-maintainer

Logo of openclaw
openclaw

Resume localise : 🦞 # OpenClaw Release Maintainer Use this skill for release and publish-time workflow. It covers ai, assistant, crustacean workflows. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

widget-generator

Logo of f
f

Resume localise : 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. This AI agent skill supports Claude Code, Cursor, and

flags

Logo of vercel
vercel

Resume localise : 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. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

138.4k
0
Navigateur

pr-review

Logo of pytorch
pytorch

Resume localise : 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. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

98.6k
0
Développeur