omgkit 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/skills/databases/mongodb/SKILL.md +81 -28
- package/plugin/skills/databases/prisma/SKILL.md +87 -32
- package/plugin/skills/databases/redis/SKILL.md +80 -27
- package/plugin/skills/devops/aws/SKILL.md +80 -26
- package/plugin/skills/devops/github-actions/SKILL.md +84 -32
- package/plugin/skills/devops/kubernetes/SKILL.md +94 -32
- package/plugin/skills/devops/performance-profiling/SKILL.md +59 -863
- package/plugin/skills/frameworks/django/SKILL.md +158 -24
- package/plugin/skills/frameworks/express/SKILL.md +153 -33
- package/plugin/skills/frameworks/fastapi/SKILL.md +153 -34
- package/plugin/skills/frameworks/laravel/SKILL.md +146 -33
- package/plugin/skills/frameworks/nestjs/SKILL.md +137 -25
- package/plugin/skills/frameworks/rails/SKILL.md +594 -28
- package/plugin/skills/frameworks/react/SKILL.md +94 -962
- package/plugin/skills/frameworks/spring/SKILL.md +528 -35
- package/plugin/skills/frameworks/vue/SKILL.md +147 -25
- package/plugin/skills/frontend/accessibility/SKILL.md +145 -36
- package/plugin/skills/frontend/frontend-design/SKILL.md +114 -29
- package/plugin/skills/frontend/responsive/SKILL.md +131 -28
- package/plugin/skills/frontend/shadcn-ui/SKILL.md +133 -43
- package/plugin/skills/frontend/tailwindcss/SKILL.md +105 -37
- package/plugin/skills/frontend/threejs/SKILL.md +110 -35
- package/plugin/skills/languages/javascript/SKILL.md +195 -34
- package/plugin/skills/methodology/brainstorming/SKILL.md +98 -30
- package/plugin/skills/methodology/defense-in-depth/SKILL.md +83 -37
- package/plugin/skills/methodology/dispatching-parallel-agents/SKILL.md +92 -31
- package/plugin/skills/methodology/executing-plans/SKILL.md +117 -28
- package/plugin/skills/methodology/finishing-development-branch/SKILL.md +111 -32
- package/plugin/skills/methodology/problem-solving/SKILL.md +65 -311
- package/plugin/skills/methodology/receiving-code-review/SKILL.md +76 -27
- package/plugin/skills/methodology/requesting-code-review/SKILL.md +93 -22
- package/plugin/skills/methodology/root-cause-tracing/SKILL.md +75 -40
- package/plugin/skills/methodology/sequential-thinking/SKILL.md +75 -224
- package/plugin/skills/methodology/systematic-debugging/SKILL.md +81 -35
- package/plugin/skills/methodology/test-driven-development/SKILL.md +120 -26
- package/plugin/skills/methodology/testing-anti-patterns/SKILL.md +88 -35
- package/plugin/skills/methodology/token-optimization/SKILL.md +73 -34
- package/plugin/skills/methodology/verification-before-completion/SKILL.md +128 -28
- package/plugin/skills/methodology/writing-plans/SKILL.md +105 -20
- package/plugin/skills/omega/omega-architecture/SKILL.md +178 -40
- package/plugin/skills/omega/omega-coding/SKILL.md +247 -41
- package/plugin/skills/omega/omega-sprint/SKILL.md +208 -46
- package/plugin/skills/omega/omega-testing/SKILL.md +253 -42
- package/plugin/skills/omega/omega-thinking/SKILL.md +263 -51
- package/plugin/skills/security/better-auth/SKILL.md +83 -34
- package/plugin/skills/security/oauth/SKILL.md +118 -35
- package/plugin/skills/security/owasp/SKILL.md +112 -35
- package/plugin/skills/testing/playwright/SKILL.md +141 -38
- package/plugin/skills/testing/pytest/SKILL.md +137 -38
- package/plugin/skills/testing/vitest/SKILL.md +124 -39
- package/plugin/skills/tools/document-processing/SKILL.md +111 -838
- package/plugin/skills/tools/image-processing/SKILL.md +126 -659
- package/plugin/skills/tools/mcp-development/SKILL.md +85 -758
- package/plugin/skills/tools/media-processing/SKILL.md +118 -735
- package/plugin/stdrules/SKILL_STANDARDS.md +490 -0
|
@@ -1,64 +1,149 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Vitest
|
|
2
|
+
name: Testing with Vitest
|
|
3
|
+
description: Claude writes fast, reliable tests using Vitest for TypeScript/JavaScript projects. Use when writing unit tests, component tests, setting up mocks, snapshot testing, or configuring test coverage.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Vitest
|
|
6
|
+
# Testing with Vitest
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
```typescript
|
|
10
|
-
import { describe, it, expect } from 'vitest';
|
|
8
|
+
## Quick Start
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
10
|
+
```typescript
|
|
11
|
+
// vitest.config.ts
|
|
12
|
+
import { defineConfig } from "vitest/config";
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
test: {
|
|
16
|
+
globals: true,
|
|
17
|
+
environment: "jsdom",
|
|
18
|
+
setupFiles: ["./tests/setup.ts"],
|
|
19
|
+
coverage: {
|
|
20
|
+
provider: "v8",
|
|
21
|
+
reporter: ["text", "html"],
|
|
22
|
+
thresholds: { global: { branches: 80, functions: 80, lines: 80 } },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
20
25
|
});
|
|
26
|
+
|
|
27
|
+
// tests/setup.ts
|
|
28
|
+
import { afterEach, vi } from "vitest";
|
|
29
|
+
import { cleanup } from "@testing-library/vue";
|
|
30
|
+
import "@testing-library/jest-dom/vitest";
|
|
31
|
+
|
|
32
|
+
afterEach(() => { vi.clearAllMocks(); cleanup(); });
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
##
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
| Feature | Description | Reference |
|
|
38
|
+
|---------|-------------|-----------|
|
|
39
|
+
| Unit Testing | Fast isolated tests with describe/it/expect | [Vitest API](https://vitest.dev/api/) |
|
|
40
|
+
| Mocking | Module, function, and timer mocking with vi | [Mocking Guide](https://vitest.dev/guide/mocking.html) |
|
|
41
|
+
| Snapshot Testing | Component and data structure snapshots | [Snapshot Testing](https://vitest.dev/guide/snapshot.html) |
|
|
42
|
+
| Component Testing | Vue/React component testing with Testing Library | [Vue Test Utils](https://test-utils.vuejs.org/) |
|
|
43
|
+
| Coverage Reports | V8/Istanbul coverage with thresholds | [Coverage](https://vitest.dev/guide/coverage.html) |
|
|
44
|
+
| Parallel Execution | Multi-threaded test runner | [Test Runner](https://vitest.dev/guide/features.html) |
|
|
45
|
+
|
|
46
|
+
## Common Patterns
|
|
47
|
+
|
|
48
|
+
### Unit Testing with Parametrization
|
|
49
|
+
|
|
24
50
|
```typescript
|
|
25
|
-
it
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
import { describe, it, expect, test } from "vitest";
|
|
52
|
+
|
|
53
|
+
describe("String Utils", () => {
|
|
54
|
+
test.each([
|
|
55
|
+
["hello", 3, "hel..."],
|
|
56
|
+
["hi", 10, "hi"],
|
|
57
|
+
["test", 4, "test"],
|
|
58
|
+
])('truncate("%s", %d) returns "%s"', (str, len, expected) => {
|
|
59
|
+
expect(truncate(str, len)).toBe(expected);
|
|
60
|
+
});
|
|
28
61
|
});
|
|
29
62
|
```
|
|
30
63
|
|
|
31
|
-
|
|
64
|
+
### Mocking Modules and Services
|
|
65
|
+
|
|
32
66
|
```typescript
|
|
33
|
-
import { vi } from
|
|
67
|
+
import { describe, it, expect, vi, beforeEach, Mock } from "vitest";
|
|
68
|
+
import { UserService } from "@/services/user";
|
|
69
|
+
import { apiClient } from "@/lib/api";
|
|
34
70
|
|
|
35
|
-
vi.mock(
|
|
36
|
-
|
|
71
|
+
vi.mock("@/lib/api", () => ({
|
|
72
|
+
apiClient: { get: vi.fn(), post: vi.fn() },
|
|
37
73
|
}));
|
|
38
74
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
75
|
+
describe("UserService", () => {
|
|
76
|
+
beforeEach(() => vi.clearAllMocks());
|
|
77
|
+
|
|
78
|
+
it("fetches user from API", async () => {
|
|
79
|
+
const mockUser = { id: "1", name: "John" };
|
|
80
|
+
(apiClient.get as Mock).mockResolvedValue({ data: mockUser });
|
|
81
|
+
|
|
82
|
+
const user = await new UserService().getUser("1");
|
|
83
|
+
|
|
84
|
+
expect(apiClient.get).toHaveBeenCalledWith("/users/1");
|
|
85
|
+
expect(user).toEqual(mockUser);
|
|
86
|
+
});
|
|
42
87
|
});
|
|
43
88
|
```
|
|
44
89
|
|
|
45
|
-
|
|
90
|
+
### Vue Component Testing
|
|
91
|
+
|
|
46
92
|
```typescript
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
93
|
+
import { describe, it, expect, vi } from "vitest";
|
|
94
|
+
import { mount } from "@vue/test-utils";
|
|
95
|
+
import Button from "@/components/Button.vue";
|
|
96
|
+
|
|
97
|
+
describe("Button", () => {
|
|
98
|
+
it("emits click event", async () => {
|
|
99
|
+
const wrapper = mount(Button, { slots: { default: "Click" } });
|
|
100
|
+
await wrapper.trigger("click");
|
|
101
|
+
expect(wrapper.emitted("click")).toHaveLength(1);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("is disabled when loading", () => {
|
|
105
|
+
const wrapper = mount(Button, { props: { loading: true } });
|
|
106
|
+
expect(wrapper.attributes("disabled")).toBeDefined();
|
|
107
|
+
});
|
|
56
108
|
});
|
|
57
109
|
```
|
|
58
110
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
vitest
|
|
63
|
-
|
|
111
|
+
### Testing Async Operations with Timers
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
115
|
+
|
|
116
|
+
describe("Debounce", () => {
|
|
117
|
+
beforeEach(() => vi.useFakeTimers());
|
|
118
|
+
afterEach(() => vi.useRealTimers());
|
|
119
|
+
|
|
120
|
+
it("delays function execution", () => {
|
|
121
|
+
const fn = vi.fn();
|
|
122
|
+
const debouncedFn = debounce(fn, 100);
|
|
123
|
+
|
|
124
|
+
debouncedFn();
|
|
125
|
+
expect(fn).not.toHaveBeenCalled();
|
|
126
|
+
|
|
127
|
+
vi.advanceTimersByTime(100);
|
|
128
|
+
expect(fn).toHaveBeenCalledTimes(1);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
64
131
|
```
|
|
132
|
+
|
|
133
|
+
## Best Practices
|
|
134
|
+
|
|
135
|
+
| Do | Avoid |
|
|
136
|
+
|----|-------|
|
|
137
|
+
| Use descriptive test names explaining behavior | Testing implementation details |
|
|
138
|
+
| Test behavior, not internal state | Sharing state between tests |
|
|
139
|
+
| Use test.each for multiple similar cases | Using arbitrary timeouts |
|
|
140
|
+
| Mock external dependencies | Over-mocking internal modules |
|
|
141
|
+
| Keep tests focused and isolated | Duplicating test coverage |
|
|
142
|
+
| Write tests alongside code | Ignoring flaky tests |
|
|
143
|
+
|
|
144
|
+
## References
|
|
145
|
+
|
|
146
|
+
- [Vitest Documentation](https://vitest.dev/)
|
|
147
|
+
- [Vue Test Utils](https://test-utils.vuejs.org/)
|
|
148
|
+
- [Testing Library](https://testing-library.com/)
|
|
149
|
+
- [Vitest Coverage](https://vitest.dev/guide/coverage.html)
|