ReviewOS

also looking at this

zig-utils/zig-test-framework

Unify discovery and programmatic test execution

#23
Merged glennmichael123 wants to merge codex/issue-5-unified-test-pipeline into main
12 files +656 -169
src/main.zigmodified+15-1
Changes to src/main.zig
@@ -161,6 +161,11 @@ pub fn main(init: std.process.Init.Minimal) !void {
161161 }
162162
163163 var all_passed: bool = undefined;
164 const stdout_file = std.Io.File.stdout();
165 var stdout_buffer: [4096]u8 = undefined;
166 var reporter_io: std.Io.Threaded = .init(std.mem.Allocator.failing, .{ .environ = .empty });
167 defer reporter_io.deinit();
168 var stdout_writer = stdout_file.writer(reporter_io.io(), &stdout_buffer);
164169 const shard_options: ?lib.ShardOptions = if (cli_parser.options.shard_index) |index|
165170 .{ .index = index, .count = cli_parser.options.shard_count.? }
166171 else
@@ -206,6 +211,10 @@ pub fn main(init: std.process.Init.Minimal) !void {
206211 .verbose = cli_parser.options.verbose,
207212 .use_colors = !cli_parser.options.no_color,
208213 .shard = shard_options,
214 .reporter_type = cli_parser.options.reporter,
215 .junit_output = cli_parser.options.junit_output orelse "test-results.xml",
216 .timeout_ms = cli_parser.options.timeout,
217 .reporter_writer = &stdout_writer.interface,
209218 .coverage_options = cov_opts,
210219 .ui_server = if (ui_server) |*server| server else null,
211220 };
@@ -245,6 +254,10 @@ pub fn main(init: std.process.Init.Minimal) !void {
245254 .verbose = cli_parser.options.verbose,
246255 .use_colors = !cli_parser.options.no_color,
247256 .shard = shard_options,
257 .reporter_type = cli_parser.options.reporter,
258 .junit_output = cli_parser.options.junit_output orelse "test-results.xml",
259 .timeout_ms = cli_parser.options.timeout,
260 .reporter_writer = &stdout_writer.interface,
248261 .coverage_options = cov_opts,
249262 .ui_server = if (ui_server) |*server| server else null,
250263 };
@@ -256,7 +269,8 @@ pub fn main(init: std.process.Init.Minimal) !void {
256269 defer lib.cleanupRegistry();
257270
258271 // Create test runner with CLI options
259 const runner_options = cli_parser.toRunnerOptions();
272 var runner_options = cli_parser.toRunnerOptions();
273 runner_options.reporter_writer = &stdout_writer.interface;
260274 var runner = lib.TestRunner.init(allocator, registry, runner_options);
261275 defer runner.deinit();
262276