mirror of
https://github.com/ditkrg/simplecov-json.git
synced 2026-01-22 22:06:46 +00:00
misc
This commit is contained in:
parent
e4d8b177b1
commit
ad09e37eeb
@ -2,14 +2,15 @@ require 'simplecov'
|
||||
require 'json'
|
||||
|
||||
class SimpleCov::Formatter::JSONFormatter
|
||||
|
||||
def format(result)
|
||||
puts result.inspect
|
||||
data = {}
|
||||
data[:timestamp] = result.created_at.to_i
|
||||
data[:command_name] = result.command_name
|
||||
data[:files] = []
|
||||
result.original_result.each do |filename, coverage|
|
||||
next unless result.filenames.include? filename
|
||||
|
||||
data[:files] << {
|
||||
filename: filename,
|
||||
coverage: coverage
|
||||
@ -27,6 +28,7 @@ class SimpleCov::Formatter::JSONFormatter
|
||||
File.open(output_filepath, "w+") do |file|
|
||||
file.puts json
|
||||
end
|
||||
|
||||
puts output_message(result)
|
||||
|
||||
json
|
||||
@ -49,4 +51,5 @@ class SimpleCov::Formatter::JSONFormatter
|
||||
def output_path
|
||||
SimpleCov.coverage_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user