Overview
Currently there are no automated tests for the generator logic. A schema
change in app/lib/config/schema.ts can silently break template output
with no warning until someone manually runs the dev loop and notices.
This issue adds a test suite that validates the generator produces correct,
expected output for every schema configuration, catching breakage before
it reaches main.
What Should Be Tested
1. Schema Validation Tests
2. Generator Output Tests
3. Flag Combination Tests
4. Regression Tests
Implementation
Test Runner
The project already uses Vitest (vitest.config.ts exists). Add tests
under the existing tests/ directory.
Snapshot Testing
Use Vitest snapshot testing for generated file contents. This way any
unintentional output change is caught automatically and must be explicitly
approved before merging.
Test Structure
tests/
├── schema/
│ ├── validation.test.ts ← schema field and default tests
│ └── conflicts.test.ts ← incompatible flag combinations
├── generator/
│ ├── output-structure.test.ts ← folder and file existence
│ ├── snapshots/ ← Vitest snapshots of critical files
│ └── flag-combinations.test.ts
└── regression/
└── (one file per bug fixed)
Acceptance Criteria
Notes
- Tests should run fast, mock the file system where possible rather than
writing to disk
- Snapshot updates should be intentional: contributors must run
bun test --update-snapshots explicitly and include the updated
snapshots in their PR
References
- tests/
- vitest.config.ts
- app/lib/config/schema.ts
- scripts/template-dev.ts
- docs/template-development.md
Overview
Currently there are no automated tests for the generator logic. A schema
change in
app/lib/config/schema.tscan silently break template outputwith no warning until someone manually runs the dev loop and notices.
This issue adds a test suite that validates the generator produces correct,
expected output for every schema configuration, catching breakage before
it reaches main.
What Should Be Tested
1. Schema Validation Tests
2. Generator Output Tests
produces the expected folder structure
(e.g. main.dart, pubspec.yaml, router.dart)
3. Flag Combination Tests
the correct dependencies in pubspec.yaml
router file
4. Regression Tests
immediately
Implementation
Test Runner
The project already uses Vitest (
vitest.config.tsexists). Add testsunder the existing
tests/directory.Snapshot Testing
Use Vitest snapshot testing for generated file contents. This way any
unintentional output change is caught automatically and must be explicitly
approved before merging.
Test Structure
tests/
├── schema/
│ ├── validation.test.ts ← schema field and default tests
│ └── conflicts.test.ts ← incompatible flag combinations
├── generator/
│ ├── output-structure.test.ts ← folder and file existence
│ ├── snapshots/ ← Vitest snapshots of critical files
│ └── flag-combinations.test.ts
└── regression/
└── (one file per bug fixed)
Acceptance Criteria
bun testruns the full suite with zero manual stepsbun testbefore dart analyzeNotes
writing to disk
bun test --update-snapshotsexplicitly and include the updatedsnapshots in their PR
References