跳到正文
cccskills
免费在 GitHub 公开

vitest

Write, review, filter, mock, and debug Core unit tests with the repository's installed Vitest 5 configuration. Use for tests under Core's Vitest include paths, `vi.mock`/spies/timers, jsdom component tests, coverage output, focused reruns, or unit-test failures. Do not use for browser E2E flows or async Next.js Server Components.

中文简介正在准备中。当前显示原文说明。

集成工具Supabase
查看安装方法

包含的文件(2)

  • SKILL.md4.3 KB
  • references/upstream.md1.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Vitest in Core

Use the repository harness as the source of truth. Core currently resolves Vitest 5.0.3 from bun.lock; verify the exact version before relying on a newly introduced API.

Authority and test surface

Read these before changing tests or configuration:

  • vitest.config.ts — include globs, aliases, Node default environment, timeouts, mock clearing, setup, and the custom coverage provider.
  • tests/setup/unit-env.ts — safe env defaults and browser shims.
  • scripts/verify/unit-tests.mjs — the full unit gate and platform behavior.
  • docs/ai/rules/testing.md — repository-wide test and CI policy.
  • .next-docs/01-app/02-guides/testing/vitest.mdx when testing Next.js code.

Do not use bun test; that selects Bun's test runner. Use Vitest through the committed scripts or bunx vitest.

Commands

# Full CI-equivalent unit suite with Core's coverage provider
bun run test:unit

# Focused file or directory while iterating
bunx vitest run tests/unit/path/to/example.test.ts

# Focused test name
bunx vitest run tests/unit/path/to/example.test.ts -t "expected behavior"

# Watch a focused surface
bunx vitest tests/unit/path/to/example.test.ts

# Structured failure report and targeted reruns
bun run test:unit:feedback

Workflow

  1. Choose the boundary. Test observable behavior at the smallest stable public boundary. Prefer pure logic/unit coverage; use Playwright when the claim depends on a real browser, routing, hydration, or an async Server Component.
  2. Place the test in an included path. Match the existing tests/unit, packages/api/tests/unit, or packages/auth conventions from vitest.config.ts; do not invent a disconnected test root.
  3. Control the environment. The default is node. Add // @vitest-environment jsdom only to files that need DOM APIs, and clean up rendered components and mutated globals.
  4. Mock boundaries, not the unit's internals. Remember that vi.mock is hoisted. Use vi.hoisted for shared mock state, dynamic imports when a module must load after mocks, and vi.importActual for intentional partial mocks.
  5. Reset all changed state. clearMocks: true clears call history but does not restore globals, timers, dates, env values, or spy implementations. Undo those changes in hooks.
  6. Run focused, then full. Iterate on the smallest file/name filter and run bun run test:unit before handoff.

Core-specific guardrails

  • Unit tests must not call live Supabase, Stripe, Resend, Payload, or network services. Use deterministic fakes at repository boundaries.
  • Keep real credentials out of tests. The committed env defaults are placeholders and intentionally clear the Supabase service-role key.
  • Assert behavior and durable contracts, not incidental class strings or implementation order unless that order is itself the contract.
  • Prefer explicit test data builders/helpers over large untyped fixture blobs.
  • Avoid .only; use .skip/.todo only with a documented reason and no hidden loss of required coverage.
  • Core's custom raw V8 coverage provider records script/function information but does not compute line, statement, or branch coverage. Its placeholder totals do not establish coverage quality. Do not claim a threshold the provider does not measure.

Checklist

  • The test exercises an observable contract at the right test layer.
  • The file is inside a configured include path and uses the correct env.
  • Mocks intercept external boundaries and respect Vitest hoisting.
  • Globals, env, timers, dates, spies, DOM, and module state are isolated.
  • Assertions are deterministic and do not depend on network or test order.
  • Focused tests pass, then bun run test:unit passes.
  • Coverage output is described without overstating its current signal.

Provenance

See references/upstream.md for the reviewed upstream source, version compatibility decision, license, and refresh workflow.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Audit and fix accessibility in Core UI. Use when changing or reviewing buttons, links, forms, validation, dialogs, menus, tabs, tables, keyboard interactions, focus management, accessible names, announcements, contrast, touch targets, reduced motion, or WCAG/a11y behavior.

中文简介正在准备中。当前显示原文说明。

Asymmetric-al/core3812026年10月19日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

中文简介正在准备中。当前显示原文说明。

Asymmetric-al/core3812026年10月19日 更新

Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they don't mention "agent" — the skill contains critical security patterns (sender allowlists, content filtering, sandboxed processing) that prevent untrusted email from controlling your system.

中文简介正在准备中。当前显示原文说明。

Asymmetric-al/core3812026年10月19日 更新

anim

免费

Tasteful, subtle web UI animation following Emil Kowalski / animations.dev principles. Use when adding or reviewing interface motion — hover and press feedback, entrances and exits, modals, toasts, menus, loading and skeleton states, staggered reveals, page or view transitions — so motion stays refined and purposeful, not decorative. Covers CSS, Web Animations, and React timing/easing. Pair with the motion skill for motion/react API specifics.

中文简介正在准备中。当前显示原文说明。

Asymmetric-al/core3812026年10月19日 更新

animate

免费

Build an animation from scratch, making the decisions in the order that determines whether it feels right — should it animate at all, what purpose, which tool, which properties, which curve and duration, how it interrupts, how it exits. Writes the implementation. Use when asked to animate something, add motion, make a component feel alive, or build a transition. For critiquing existing motion use review-animations; for auditing a whole codebase use improve-animations. Only runs when explicitly invoked; it does not trigger on its own.

中文简介正在准备中。当前显示原文说明。

Asymmetric-al/core3812026年10月19日 更新

Build animations for Expo and React Native only, using Reanimated, Gesture Handler, Expo Router, and expo-haptics. Use when the target runtime is an Expo or React Native app. Do not use it for Core Next.js web motion; use `animate` for web. Only runs when explicitly invoked; it does not trigger on its own.

中文简介正在准备中。当前显示原文说明。

Asymmetric-al/core3812026年10月19日 更新

查看 Asymmetric-al 的全部技能

报告此技能的问题