Skip to content

Commit 0975ff2

Browse files
authored
Merge pull request #320 from skipkayhil/hm-dump-to-file-2
Reapply "Dump JSON directly to file instead of buffering"
2 parents 479d530 + 80050a3 commit 0975ff2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ruby/lib/minitest/queue/build_status_reporter.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@ def progress
107107
end
108108

109109
def write_failure_file(file)
110-
File.write(file, error_reports.map(&:to_h).to_json)
110+
File.open(file, 'w') do |f|
111+
JSON.dump(error_reports.map(&:to_h), f)
112+
end
111113
end
112114

113115
def write_flaky_tests_file(file)
114-
File.write(file, flaky_reports.to_json)
116+
File.open(file, 'w') do |f|
117+
JSON.dump(flaky_reports, f)
118+
end
115119
end
116120

117121
private

ruby/lib/minitest/queue/runner.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ def display_warnings(build)
323323
warnings = build.pop_warnings.map do |type, attributes|
324324
attributes.merge(type: type)
325325
end.compact
326-
File.write(queue_config.warnings_file, warnings.to_json)
326+
File.open(queue_config.warnings_file, 'w') do |f|
327+
JSON.dump(warnings, f)
328+
end
327329
end
328330

329331
def run_tests_in_fork(queue)

0 commit comments

Comments
 (0)