also looking at this
fix: honor discovery-mode CLI options
#17
10 files
+192
-24
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -94,8 +94,15 @@ This will automatically discover and run all `*.test.zig` files in the `tests` d | ||
| 94 | 94 | - `--pattern <pattern>` - File pattern to match (default: `*.test.zig`) |
| 95 | 95 | - `--no-recursive` - Disable recursive directory search |
| 96 | 96 | - `--bail` - Stop on first failure |
| 97 | - `--filter <text>` / `--grep <text>` - Run only Zig tests whose names contain the text | |
| 98 | - `--no-color` - Disable color in child Zig test processes | |
| 97 | 99 | - `--verbose` - Show detailed output |
| 98 | 100 | |
| 101 | Discovery mode rejects options that it cannot honor yet instead of silently | |
| 102 | ignoring them. Reporter selection, quiet output, timeouts, parallel jobs, | |
| 103 | snapshot updates, memory profiling, configuration files, JUnit output, and the | |
| 104 | web UI require the shared execution pipeline planned for future releases. | |
| 105 | ||
| 99 | 106 | **Examples:** |
| 100 | 107 | |
| 101 | 108 | ```bash |
| @@ -130,6 +130,9 @@ pub fn build(b: *std.Build) void { | ||
| 130 | 130 | .target = target, |
| 131 | 131 | .optimize = optimize, |
| 132 | 132 | .link_libc = true, |
| 133 | .imports = &.{ | |
| 134 | .{ .name = "zig_test_framework", .module = lib_module }, | |
| 135 | }, | |
| 133 | 136 | }), |
| 134 | 137 | }); |
| 135 | 138 | const run_filter_tests = b.addRunArtifact(filter_tests); |
| @@ -1,19 +1,21 @@ | ||
| 1 | 1 | const std = ; |
| 2 | const ztf = ; | |
| 2 | 3 | |
| 3 | // Placeholder tests for filter module | |
| 4 | // TODO: Implement comprehensive tests for test filtering | |
| 4 | test "discovery forwards test-name filters to zig test" { | |
| 5 | const allocator = std.testing.allocator; | |
| 6 | var discovered = ztf.DiscoveryResult.init(allocator); | |
| 7 | defer discovered.deinit(); | |
| 5 | 8 | |
| 6 | test "filter by test name" { | |
| 7 | // Test filtering tests by name | |
| 8 | try std.testing.expect(true); | |
| 9 | } | |
| 9 | try discovered.addFile( | |
| 10 | "tests/fixtures/filter_fixture.zig", | |
| 11 | "fixtures/filter_fixture.zig", | |
| 12 | "filter_fixture.zig", | |
| 13 | ); | |
| 10 | 14 | |
| 11 | test "filter by pattern" { | |
| 12 | // Test filtering tests by pattern | |
| 13 | try std.testing.expect(true); | |
| 14 | } | |
| 15 | const passed = try ztf.runDiscoveredTests(allocator, &discovered, .{ | |
| 16 | .filter = "selected test passes", | |
| 17 | .use_colors = false, | |
| 18 | }); | |
| 15 | 19 | |
| 16 | test "filter combination" { | |
| 17 | // Test combined filters | |
| 18 | try std.testing.expect(true); | |
| 20 | try std.testing.expect(passed); | |
| 19 | 21 | } |