usm/gen-testspecs
Vitest test specs generator — produces per-feature and aggregated Vitest test files from flows[] and tests[] definitions.
Intent
Feature .usm files define flows and tests in a structured format. The test specs generator converts these into executable Vitest test files, producing both per-feature specs and aggregated test bundles per app.
Flows
Generate Vitest test specs (gen-test-specs)
Convert flows and tests from .usm into Vitest describe/it blocks
- parse → all feature .usm files with tests and flows
- generate → per-feature .test.ts files with describe blocks
- generate → aggregated test bundles per app
- submit → write to tests/auto-generated/
Flow Diagrams
mermaid
sequenceDiagram
participant User
participant Browser
participant Server
User->>Browser: parse all feature .usm files with tests and flows
User->>Browser: generate per-feature .test.ts files with describe blocks
User->>Browser: generate aggregated test bundles per app
User->>Browser: submit write to tests/auto-generated/Contracts
test-specs-runnable
Generated test specs must be syntactically valid Vitest files
Acceptance criteria:
- [ ] Each flow maps to a describe block
- [ ] Each test maps to an it block with setup and expect
- [ ] Aggregated specs import per-feature files
Tests
test-specs-per-feature
Given:
- feature_with_tests: true
Then:
- assertion: .test.ts file generated with valid syntax
- assertion: Contains describe and it blocks
test-specs-aggregated
Given:
- multiple_features: true
Then:
- assertion: Aggregated test file imports per-feature specs
Implementation
- Primary: src/generators/testSpecs.ts
- Test code status: none
See Also
- usm/cli-generate