ReviewOS

also looking at this

zig-utils/zig-test-framework

fix: honor discovery-mode CLI options

#17
Merged glennmichael123 wants to merge codex/issue-2-discovery-cli into main
10 files +192 -24
src/main.zigmodified+13-1
Changes to src/main.zig
@@ -74,6 +74,16 @@ pub fn main(init: std.process.Init.Minimal) !void {
7474 // Check if we should use test discovery or programmatic tests
7575 const use_discovery = cli_parser.options.test_dir != null;
7676
77 if (use_discovery) {
78 if (cli_parser.unsupportedDiscoveryOption()) |option| {
79 std.debug.print(
80 "Error: {s} cannot be honored in test discovery mode\n",
81 .{option},
82 );
83 std.process.exit(2);
84 }
85 }
86
7787 // Start UI server if requested
7888 var ui_server: ?lib.UIServer = null;
7989 var ui_thread: ?std.Thread = null;
@@ -176,6 +186,7 @@ pub fn main(init: std.process.Init.Minimal) !void {
176186 .bail = cli_parser.options.bail,
177187 .filter = cli_parser.options.filter,
178188 .verbose = cli_parser.options.verbose,
189 .use_colors = !cli_parser.options.no_color,
179190 .coverage_options = cov_opts,
180191 .ui_server = if (ui_server) |*server| server else null,
181192 };
@@ -192,7 +203,7 @@ pub fn main(init: std.process.Init.Minimal) !void {
192203 .recursive = !cli_parser.options.no_recursive,
193204 };
194205
195 std.debug.print("Discovering tests in '{s}' with pattern '*{s}'...\n\n", .{ discovery_options.root_path, discovery_options.pattern });
206 std.debug.print("Discovering tests in '{s}' with pattern '{s}'...\n\n", .{ discovery_options.root_path, discovery_options.pattern });
196207
197208 var discovered = try lib.discoverTests(allocator, discovery_options);
198209 defer discovered.deinit();
@@ -213,6 +224,7 @@ pub fn main(init: std.process.Init.Minimal) !void {
213224 .bail = cli_parser.options.bail,
214225 .filter = cli_parser.options.filter,
215226 .verbose = cli_parser.options.verbose,
227 .use_colors = !cli_parser.options.no_color,
216228 .coverage_options = cov_opts,
217229 .ui_server = if (ui_server) |*server| server else null,
218230 };