File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,12 @@ const Writer = struct {
203203
204204 fn finalize (self : * Writer ) ! void {
205205 if (self .format == .json ) {
206- try self .out .writeByte (']' );
206+ // When we write a test output, we add a trailing comma to act as
207+ // a separator for the next test. We need to add this dummy entry
208+ // to make it valid json.
209+ // Better option could be to change the formatter to work on JSONL:
210+ // https://github.com/lightpanda-io/perf-fmt/blob/main/wpt/wpt.go
211+ try self .out .writeAll ("{\" name\" :\" trailing-hack\" ,\" pass\" : true}]" );
207212 } else {
208213 try self .out .print ("\n ==Summary==\n Tests: {d}/{d}\n Cases: {d}/{d}\n " , .{
209214 self .pass_count ,
@@ -298,6 +303,8 @@ const Writer = struct {
298303 .name = test_file ,
299304 .cases = cases .items ,
300305 }, .{ .whitespace = .indent_2 }, self .out );
306+ // separator, see `finalize` for the hack we use to terminate this
307+ try self .out .writeByte (',' );
301308 },
302309 }
303310 }
You can’t perform that action at this time.
0 commit comments