بنقرة واحدة
write-tests
Write tests following this project's testing conventions, file patterns, and placement rules
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Write tests following this project's testing conventions, file patterns, and placement rules
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Create a changeset entry describing changes to workspace packages
Scaffold a new UI component with the correct folder structure, styles, tests, and docblocks
Scaffold a new class with the correct file structure, naming, tests, and docblocks
Scaffold a new runtime type guard with the correct naming and docblocks
Scaffold a new utility function with the correct naming, tests, and docblocks
Create a git commit following this project's commit message conventions
| name | write-tests |
| description | Write tests following this project's testing conventions, file patterns, and placement rules |
| user-invocable | false |
When writing tests in this project, follow these conventions exactly.
| Type | File pattern | Runner | Purpose |
|---|---|---|---|
| Unit | *.unit.ts / *.unit.tsx | Vitest | Isolated logic, single module |
| Integration | *.integration.ts / *.integration.tsx | Vitest | Cross-module interaction |
| Performance | *.bench.ts / *.bench.tsx | Vitest Bench | Execution speed and regression guard |
| E2E | *.e2e.ts / *.e2e.tsx | Vitest | Full application user flows |
Tests live in a specs/ folder colocated with the code they test (inside each subdirectory of a module).
src/classes/
├── MyClass.ts
└── specs/
└── MyClass.unit.ts
src/components/
└── MyComponent/
├── component.tsx
└── specs/
└── MyComponent.unit.tsx
src/services/
├── ThingService.ts
└── specs/
└── ThingService.unit.ts
parseSelector.ts → specs/parseSelector.unit.tsserializeNode.ts → specs/serializeNode.unit.tsselectors.unit.ts or serialization.unit.ts when the production code is split across multiple utility files.Use the testing/ directory within modules for shared mocks, factories, and test utilities.
src/testing/
├── mocks/
└── factories/
Performance benchmarks use Vitest's bench API. They live in specs/ alongside other tests.
src/classes/
├── MyClass.ts
└── specs/
├── MyClass.unit.ts
└── MyClass.bench.ts
Benchmarks track the execution performance of specific operations. They run across many iterations automatically and report ops/sec, helping detect performance regressions as the library evolves.
import {bench, describe} from 'vitest';
import {MyClass} from '../MyClass';
const input = generateRealisticInput(); // Setup outside bench callback
describe('MyClass', () => {
bench('processes a typical document tree', () => {
const instance = new MyClass();
instance.doWork(input);
});
bench('processes a large document tree', () => {
const instance = new MyClass();
instance.doWork(largeInput);
});
});
.bench.ts file.bench() call so setup cost is not measured.pnpm test:performancespecs/ folder with the correct suffixsrc/testing/ where appropriatepnpm run check to verify tests pass