ReviewOS

also looking at this

zig-utils/zig-test-framework

feat: load strict JSON configuration files

#19
Merged glennmichael123 wants to merge codex/issue-12-config into main
10 files +249 -286
README.mdmodified+31-4
Changes to README.md
@@ -24,7 +24,7 @@ A modern, feature-rich testing framework for Zig inspired by Jest, Vitest, and B
2424- **Watch Mode** - Automatically re-run tests on file changes
2525- **Memory Profiling** - Track memory usage and detect leaks
2626- **Parallel Execution** - Run tests in parallel for faster execution
27- **Configuration Files** - YAML/JSON/TOML config file support
27- **Configuration Files** - Strict JSON config files with CLI overrides
2828
2929## Installation
3030
@@ -100,8 +100,8 @@ This will automatically discover and run all `*.test.zig` files in the `tests` d
100100
101101Discovery mode rejects options that it cannot honor yet instead of silently
102102ignoring them. Reporter selection, quiet output, timeouts, parallel jobs,
103snapshot updates, memory profiling, configuration files, JUnit output, and the
104web UI require the shared execution pipeline planned for future releases.
103snapshot updates, memory profiling, JUnit output, and the web UI require the
104shared execution pipeline planned for future releases.
105105
106106**Examples:**
107107
@@ -119,6 +119,33 @@ zig-test --test-dir tests --no-recursive
119119zig-test --test-dir tests --bail
120120```
121121
122### Configuration files
123
124`--config <file>` loads a strict JSON configuration before test discovery.
125Unknown keys, duplicate keys, wrong value types, unsupported extensions, and
126invalid runtime values fail with a configuration error. TOML and YAML are not
127currently supported. Explicit CLI options are parsed after the file and take
128precedence over configured values.
129
130```json
131{
132 "test": {
133 "test_dir": "tests",
134 "pattern": "*.test.zig",
135 "recursive": true,
136 "filter": "database"
137 },
138 "coverage": {
139 "enabled": false,
140 "output_dir": "coverage"
141 }
142}
143```
144
145The accepted top-level sections are `test`, `parallel`, `reporter`, `snapshot`,
146`watch`, `memory`, `ui`, and `coverage`. Options retain the same execution-mode
147limitations as their CLI equivalents; unsupported combinations fail explicitly.
148
122149### Programmatic Mode
123150
124151For more control, you can manually register tests:
@@ -824,7 +851,7 @@ MIT License - see [LICENSE](LICENSE) for details.
824851- [x] Watch mode for file changes
825852- [x] TAP/JUnit reporters
826853- [x] Memory profiling
827- [x] Configuration files (YAML/JSON/TOML)
854- [x] Strict JSON configuration files
828855- [x] Parallel test execution
829856- [ ] Parameterized tests (it.each)
830857- [ ] Property-based testing