Token导航 LogoToken导航

Agent Skill · 待分类

vue-vite-testing(Vue Vite 测试)

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

vue-vite-testing 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为权限未标注;许可证信息还不明确,暂无第三方扫描结果,按安装量在待分类类的 11,209 个 Skill 里排第 8,476。

总安装 294周安装 12GitHub Stars 2下载 94核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/eva813/vue3-skills --skill vue-vite-testing

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

用于 Vue Vite 测试相关的技术支持。适合处理 Vue 3 + Vite 环境下的测试配置。可协助生成测试用例和测试工具链配置。vue-vite-testing 属于待分类类 Skill,可作为该场景下的辅助能力补充。使用时应确保与 Vite 构建工具和测试框架兼容。

安装方式:通过 GitHub 仓库安装,适用于 Claude 等宿主。

来源仓库内路径:skills/vue-vite-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/eva813/vue3-skills --skill vue-vite-testing;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    权限没有明确标注,第一次使用时只给一个无关紧要的任务,观察它到底读了哪些文件和网络。

常见问题

6 条

vue-vite-testing 怎么安装?

在终端执行 npx skills add https://github.com/eva813/vue3-skills --skill vue-vite-testing。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

vue-vite-testing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

vue-vite-testing 需要什么权限?

权限级别没有明确标注。第一次使用时建议只给无关紧要的任务,观察它实际读写了哪些内容。

vue-vite-testing 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

vue-vite-testing 用的人多吗?

公开数据是累计安装 294 次,近一周安装 12 次,下载 94 次,GitHub 2 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

vue-vite-testing 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 要求有安全扫描结论才肯安装的团队。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
vue-vite-testing

Vue Vite 测试 · 本页

2942权限未标注未明确未收录

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
vue-vite-testing
description
Comprehensive unit testing guide for Vue 3 + Vite projects using Vitest and Vue Test Utils. Use when writing or reviewing unit tests for Vue components, composables, Pinia stores, or TypeScript/JavaScript utilities in Vite-based projects. Covers test structure, best practices, mocking strategies, and Vue-specific testing patterns.

Vue + Vite Unit Testing

Overview

Generate comprehensive, production-ready unit tests for Vue 3 + Vite projects using Vitest framework. Follow industry best practices for testing Vue components, composables, Pinia stores, and TypeScript utilities with proper isolation, mocking, and edge case coverage.

Testing Framework Setup

Primary Stack:

  • Vitest: Fast unit test framework built for Vite
  • Vue Test Utils: Official testing utility library for Vue components
  • @vitest/ui: Optional UI for test visualization

Import pattern:

import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { mount, shallowMount } from '@vue/test-utils';

Testing Workflow

Follow this systematic approach for all testing tasks:

1. Code Analysis Phase

Before writing any tests:

  • Analyze the code structure and identify all public interfaces
  • Identify external dependencies (APIs, stores, composables, modules)
  • Note all possible code paths, conditions, and edge cases
  • Ask clarifying questions about:

- Missing type definitions or constants - Unclear business logic or validation rules - External API contracts or data structures - Expected error handling behaviors

Only proceed to writing tests after full code understanding.

2. Test Design Phase

Plan test coverage:

  • Happy path scenarios (expected inputs and outputs)
  • Error handling and failure modes
  • Edge cases (empty arrays, null values, boundary conditions)
  • Async operations (loading, success, error states)
  • User interactions (clicks, inputs, form submissions)
  • Lifecycle hooks and reactivity

For Vue components, identify:

  • Props validation and default values
  • Emitted events and their payloads
  • Slots usage and content projection
  • Computed properties and watchers
  • Component lifecycle behavior

For composables, identify:

  • Input parameters and return values
  • State management and reactivity
  • Side effects (API calls, localStorage, timers)
  • Cleanup requirements

Test Structure Standards

Standard Test Template

import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';

describe('ModuleName or ComponentName', () => {
  // Top-level test variables
  let mockDependency: MockType;
  
  beforeEach(() => {
    // Reset state before each test
    mockDependency = createMockDependency();
  });

  afterEach(() => {
    // Cleanup after each test
    vi.clearAllMocks();
  });

  describe('method or feature name', () => {
    it('should handle happy path scenario', () => {
      // Arrange: Set up test data and mocks
      const input = { /* test data */ };
      
      // Act: Execute the code under test
      const result = functionUnderTest(input);
      
      // Assert: Verify expected outcomes
      expect(result).toBe(expectedValue);
    });

    it('should handle error case', async () => {
      // Arrange
      mockDependency.method.mockRejectedValue(new Error('test error'));
      
      // Act & Assert
      await expect(functionUnderTest()).rejects.toThrow('test error');
    });

    it('should handle edge case: empty input', () => {
      // Test edge cases
      expect(functionUnderTest([])).toEqual([]);
    });
  });
});

AAA Pattern (Arrange-Act-Assert)

Always structure individual tests using AAA:

it('should calculate total price correctly', () => {
  // Arrange: Set up test data
  const items = [
    { price: 100, quantity: 2 },
    { price: 50, quantity: 1 }
  ];
  
  // Act: Execute the function
  const total = calculateTotal(items);
  
  // Assert: Verify the result
  expect(total).toBe(250);
});

Vue-Specific Testing Patterns

1. Component Testing

Decide between mount vs shallowMount:

  • Use mount() for integration testing with child components
  • Use shallowMount() for isolated unit testing (stubs child components)
import { mount } from '@vue/test-utils';
import MyComponent from './MyComponent.vue';

describe('MyComponent', () => {
  it('should render with props', () => {
    const wrapper = mount(MyComponent, {
      props: {
        title: 'Test Title',
        count: 5
      }
    });
    
    expect(wrapper.find('h1').text()).toBe('Test Title');
    expect(wrapper.find('.count').text()).toBe('5');
  });

  it('should emit event on button click', async () => {
    const wrapper = mount(MyComponent);
    
    await wrapper.find('button').trigger('click');
    
    expect(wrapper.emitted('submit')).toBeTruthy();
    expect(wrapper.emitted('submit')[0]).toEqual([{ data: 'value' }]);
  });

  it('should handle v-model binding', async () => {
    const wrapper = mount(MyComponent, {
      props: {
        modelValue: 'initial'
      }
    });
    
    await wrapper.find('input').setValue('updated');
    
    expect(wrapper.emitted('update:modelValue')[0]).toEqual(['updated']);
  });
});

See references/component-testing.md for complete component testing patterns including slots, provide/inject, and async components.

2. Composables Testing

import { composableUnderTest } from './useFeature';

describe('useFeature composable', () => {
  it('should initialize with default state', () => {
    const { state, count } = composableUnderTest();
    
    expect(state.value).toBe('idle');
    expect(count.value).toBe(0);
  });

  it('should update reactive state', () => {
    const { increment, count } = composableUnderTest();
    
    increment();
    
    expect(count.value).toBe(1);
  });

  it('should handle async operations', async () => {
    const { fetchData, data, loading } = composableUnderTest();
    
    expect(loading.value).toBe(false);
    
    const promise = fetchData();
    expect(loading.value).toBe(true);
    
    await promise;
    expect(loading.value).toBe(false);
    expect(data.value).toBeDefined();
  });
});

See references/composables-testing.md for advanced composable testing patterns including side effects and cleanup.

3. Pinia Store Testing

import { setActivePinia, createPinia } from 'pinia';
import { useMyStore } from './myStore';

describe('myStore', () => {
  beforeEach(() => {
    setActivePinia(createPinia());
  });

  it('should initialize with default state', () => {
    const store = useMyStore();
    
    expect(store.items).toEqual([]);
    expect(store.loading).toBe(false);
  });

  it('should add item to store', () => {
    const store = useMyStore();
    const newItem = { id: 1, name: 'Test' };
    
    store.addItem(newItem);
    
    expect(store.items).toContainEqual(newItem);
  });

  it('should handle async actions', async () => {
    const store = useMyStore();
    
    await store.fetchItems();
    
    expect(store.loading).toBe(false);
    expect(store.items.length).toBeGreaterThan(0);
  });
});

See references/store-testing.md for Pinia store testing patterns including getters, mutations, and actions.

Mocking Strategies

External Dependencies

// Mock API calls
vi.mock('@/api/users', () => ({
  fetchUsers: vi.fn(),
  createUser: vi.fn()
}));

// Mock composables
vi.mock('@/composables/useAuth', () => ({
  useAuth: vi.fn(() => ({
    user: { id: 1, name: 'Test User' },
    isAuthenticated: true,
    login: vi.fn(),
    logout: vi.fn()
  }))
}));

// Mock Vue Router
const mockRouter = {
  push: vi.fn(),
  replace: vi.fn()
};

const wrapper = mount(Component, {
  global: {
    mocks: {
      $router: mockRouter
    }
  }
});

Timers and Delays

import { vi } from 'vitest';

describe('setTimeout behavior', () => {
  beforeEach(() => {
    vi.useFakeTimers();
  });

  afterEach(() => {
    vi.useRealTimers();
  });

  it('should execute callback after delay', () => {
    const callback = vi.fn();
    
    setTimeout(callback, 1000);
    
    expect(callback).not.toHaveBeenCalled();
    
    vi.advanceTimersByTime(1000);
    
    expect(callback).toHaveBeenCalledOnce();
  });
});

Testing Best Practices

1. Test Isolation

  • Each test should be independent and not rely on other tests
  • Use beforeEach to reset state
  • Clean up mocks with vi.clearAllMocks() or vi.resetAllMocks()

2. Descriptive Test Names

// ✅ Good: Clear and descriptive
it('should display error message when API request fails', () => {});

// ❌ Bad: Vague and unclear
it('should work', () => {});

3. Avoid Test Logic

// ❌ Bad: Contains loops and conditions
it('should validate all items', () => {
  for (const item of items) {
    if (item.type === 'special') {
      expect(validate(item)).toBe(true);
    }
  }
});

// ✅ Good: Simple and direct
it('should validate special item', () => {
  const specialItem = { type: 'special', value: 100 };
  expect(validate(specialItem)).toBe(true);
});

it('should validate normal item', () => {
  const normalItem = { type: 'normal', value: 50 };
  expect(validate(normalItem)).toBe(true);
});

4. Test Coverage Priority

  1. Critical business logic (payment, authentication, data validation)
  2. Complex algorithms (calculations, transformations)
  3. Error handling (edge cases, failure modes)
  4. User interactions (forms, buttons, navigation)
  5. Integration points (API calls, external services)

5. Async Testing

// ✅ Properly handle async operations
it('should fetch data successfully', async () => {
  const result = await fetchData();
  expect(result).toBeDefined();
});

// ✅ Use resolves/rejects for promises
await expect(fetchData()).resolves.toEqual(expectedData);
await expect(failingOperation()).rejects.toThrow('Error message');

Complete Test Deliverables

When generating tests, always provide:

  1. Complete test suites - No placeholders or "// TODO" comments
  2. All edge cases covered - Empty inputs, null values, boundaries
  3. Proper imports - All necessary test utilities and dependencies
  4. Appropriate mocks - For external dependencies and side effects
  5. Clear test descriptions - Self-documenting test names
  6. Proper cleanup - afterEach hooks where needed

Reference Files

For detailed examples and advanced patterns:

  • references/component-testing.md - Comprehensive component testing patterns (slots, teleport, provide/inject, async components)
  • references/composables-testing.md - Advanced composable testing (side effects, watchers, cleanup)
  • references/store-testing.md - Pinia store testing patterns (getters, actions, state management)

平台分布

Codex

35.43%
按下载量换算33

Claude

29.49%
按下载量换算28

Cursor

17.28%
按下载量换算16

Gemini CLI

8%
按下载量换算8

安全审计

暂无安全审计结果可展示。

权限和风险

权限未标注

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

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

继续浏览同类 Skills