Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

vue-test-utils-skilldVue 测试 utils skilld

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

2,324

周安装

94

GitHub Stars

156

下载量

729
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:vue-test-utils-skilld(Vue 测试 utils skilld)
来源仓库:https://github.com/harlan-zw/vue-ecosystem-skills
仓库路径:skills/vue-test-utils-skilld
安装命令:
npx skills add https://github.com/harlan-zw/vue-ecosystem-skills --skill vue-test-utils-skilld
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/harlan-zw/vue-ecosystem-skills --skill vue-test-utils-skilld

简介

用于辅助 Vue 测试工具的研究与使用。

  • 适合查找 Vue Test Utils 相关资源和测试方案。
  • 可协助获取单元测试和组件测试的最佳实践。
  • 建议结合实际测试框架和项目结构使用。vue-test-utils-skilld 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 安装方式:通过 GitHub 仓库安装,支持主流 AI 编程工具。

SKILL.md

vuejs/test-utils @vue/test-utils@2.4.6

Tags: latest: 2.4.6, 2.0.0-alpha.0: 2.0.0-alpha.0, 2.0.0-alpha.1: 2.0.0-alpha.1

References: Docs

API Changes

This section documents version-specific API changes — prioritize recent major/minor releases.

  • BREAKING: propsData — v2 renamed to props for consistency with component definitions source
  • BREAKING: createLocalVue — removed in v2, use the global mounting option to install plugins, mixins, or directives source
  • BREAKING: mocks and stubs — moved into the global mounting option in v2 as they apply to all components source
  • BREAKING: destroy() — renamed to unmount() in v2 to match Vue 3 lifecycle naming source
  • BREAKING: findAll().at() — removed in v2; findAll() now returns a standard array of wrappers source
  • BREAKING: createWrapper() — removed in v2, use the new DOMWrapper() constructor for non-component elements source
  • BREAKING: shallowMount — v2 no longer renders default slot content for stubbed components by default source
  • BREAKING: find() — now only supports querySelector syntax; use findComponent() to locate Vue components source
  • BREAKING: setSelected and setChecked — removed in v2, functionality merged into setValue() source
  • BREAKING: attachToDocument — renamed to attachTo in v2 source
  • BREAKING: emittedByOrder — removed in v2, use emitted() instead source
  • NEW: renderToString() — added in v2.3.0 to support SSR testing source
  • NEW: enableAutoUnmount() / disableAutoUnmount() — replaces enableAutoDestroy in v2 source
  • DEPRECATED: scopedSlots — removed in v2 and merged into the slots mounting option source

Also changed: setValue() and trigger() return nextTick · slots scope exposed as params in string templates · is, isEmpty, isVueInstance, name, setMethods, and contains removed

Best Practices

  • Always await methods that return nextTick (trigger, setValue, setProps, setData) to ensure DOM updates are processed before running assertions source
// Preferred
await wrapper.find('button').trigger('click')
expect(wrapper.text()).toContain('Count: 1')

// Avoid — assertion runs before DOM update
wrapper.find('button').trigger('click')
expect(wrapper.text()).toContain('Count: 1')
  • Prefer get() and getComponent() over find() and findComponent() when you expect the element to exist — they throw immediately if not found, providing clearer test failures source
  • Use flushPromises() to resolve non-Vue asynchronous operations such as mocked API calls (axios) or external promise-based logic that Vue doesn't track source
  • Enable enableAutoUnmount(afterEach) in your test setup to automatically clean up wrappers after every test, preventing state pollution and memory leaks source
import { enableAutoUnmount } from '@vue/test-utils'
import { afterEach } from 'vitest'

enableAutoUnmount(afterEach)
  • Wrap components with async setup() in a <Suspense> component within your test to correctly handle their asynchronous initialization source
  • Enable config.global.renderStubDefaultSlot = true when using shallow mounting to ensure content within default slots is rendered for verification source
  • Prefer mount() with specific global.stubs over shallow: true to keep tests more production-like while still isolating specific complex child components source
  • Use global.provide to pass data to components using inject, ensuring the component tree's dependency injection works as it does in production source
  • Test complex composables by mounting a minimal TestComponent that calls the composable, allowing you to verify internal state via wrapper.vm source
const TestComponent = defineComponent({
  setup() {
    return { ...useMyComposable() }
  }
})
const wrapper = mount(TestComponent)
expect(wrapper.vm.someValue).toBe(true)
  • Stub custom directives using the vName naming convention (e.g., vTooltip: true) in the global.stubs mounting option source

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.83%
按下载量换算254

Claude

30.73%
按下载量换算224

Cursor

20.27%
按下载量换算148

Gemini CLI

10.36%
按下载量换算76

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills