用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/jimmykane/quantified-self --skill test-automation命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Analyze one or more authorized Quantified Self activities through its read-only MCP tools. Use for individual workouts, activity summaries, canonical metrics, laps, MTB jumps, swim lengths, pace or power charts, breadcrumb traces, or finding activities near a place; use the training skill for aggregate trends across many activities.
Compare the user's authorized Quantified Self data across two or more health and fitness domains through its read-only MCP tools. Use for cross-domain questions such as sleep versus training, weight versus activity, or recovery trends that require combining measurements, Training metrics, sleep, activities, or routes; use the focused Quantified Self skills for single-domain requests or multiple independent summaries that do not need comparison.
Analyze the user's authorized Quantified Self sleep data through its read-only MCP tools. Use for sleep sessions, duration, stages, efficiency, naps, bedtime or wake-time patterns, HRV, sleep heart rate, blood oxygen, respiration, and sleep-oriented recovery trends; use the cross-domain Quantified Self skill when comparing sleep with training, measurements, or activities.
基于 SOC 职业分类
正在显示 SKILL.md
| name | test-automation |
| description | Generate and manage Vitest tests for Angular components, services, and Firebase integrations |
Generate comprehensive Vitest tests for the quantified-self Angular application.
| Aspect | Configuration |
|---|---|
| Framework | Vitest v3.x |
| Angular Plugin | @analogjs/vite-plugin-angular |
| Environment | jsdom |
| Coverage | @vitest/coverage-v8 |
# Run all tests
npm test
# Run with coverage
npm run test-coverage
# Run Firestore rules tests (requires emulator)
npm run test:rules
import { TestBed } from '@angular/core/testing';
import { vi, describe, it, expect, beforeEach, afterEach, Mock } from 'vitest';
import { MyService } from './my.service';
// Hoist mocks BEFORE vi.mock() calls
const mocks = vi.hoisted(() => ({
myMockedFn: vi.fn(),
}));
// Mock external modules
vi.mock('@angular/fire/firestore', async (importOriginal) => {
const actual = await importOriginal<typeof import('@angular/fire/firestore')>();
return { ...actual, doc: vi.fn(), docData: vi.fn() };
});
describe('MyService', () => {
let service: MyService;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
MyService,
{ provide: SomeDep, useValue: mockDep },
]
});
service = TestBed.inject(MyService);
vi.clearAllMocks();
});
afterEach(() => {
vi.restoreAllMocks();
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { vi, describe, it, expect, beforeEach } from 'vitest';
import { MyComponent } from './my.component';
describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [/* required modules */],
declarations: [MyComponent],
providers: [/* mocked services */]
}).compileComponents();
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
vi.mock('@angular/fire/firestore', async (importOriginal) => {
const actual = await importOriginal<typeof import('@angular/fire/firestore')>();
return {
...actual,
doc: vi.fn(),
docData: vi.fn(() => of(mockData)),
collection: vi.fn(),
collectionData: vi.fn(() => of([mockItem])),
deleteDoc: vi.fn().mockResolvedValue(undefined),
setDoc: vi.fn().mockResolvedValue(undefined),
};
});
import { of, throwError } from 'rxjs';
// Success
(someMethod as Mock).mockReturnValue(of(mockData));
// Error
(someMethod as Mock).mockReturnValue(throwError(() => new Error('Test error')));
// Store original before modifying
const originalAPI = globalThis.SomeAPI;
beforeEach(() => {
globalThis.SomeAPI = vi.fn().mockImplementation(() => ({ /* mock */ }));
});
afterEach(() => {
globalThis.SomeAPI = originalAPI;
});
| Jasmine/Karma | Vitest |
|---|---|
jasmine.createSpy() | vi.fn() |
spyOn(obj, 'method') | vi.spyOn(obj, 'method') |
and.returnValue() | .mockReturnValue() |
and.callFake() | .mockImplementation() |
toHaveBeenCalledWith() | toHaveBeenCalledWith() ✓ |
jasmine.any(Type) | expect.any(Type) |
# Generate coverage report
npm run test-coverage
# Output: coverage/index.html
vitest: vi, describe, it, expect, beforeEach, afterEachvi.hoisted() for mock values needed in vi.mock()async (importOriginal) patternvi.clearAllMocks() in beforeEachvi.restoreAllMocks() in afterEachas Mock for .mockReturnValue() calls