Class: Minitest::Reporters::JsonReporter

Inherits:
BaseReporter
  • Object
show all
Defined in:
lib/minitest/reporters/json_reporter.rb,
lib/minitest/reporters/json_reporter/version.rb

Overview

Minitest Reporter that produces a JSON output for interface in IDEs, editor.

Constant Summary collapse

VERSION =

Version of the Minitest::Reporters::JsonReporter gem.

'1.0.0'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ JsonReporter

Constructor for Minitest::Reporters::JsonReporter Takes possible options. E.g. :verbose => true



21
22
23
# File 'lib/minitest/reporters/json_reporter.rb', line 21

def initialize(options = {})
  super
end

Instance Attribute Details

#storageObject

Hash that represents the final elements prior to being converted to JSON



27
28
29
# File 'lib/minitest/reporters/json_reporter.rb', line 27

def storage
  @storage
end

Instance Method Details

#reportObject

Called by runner to report the conclusion of the test run Converts result of to_h to JSON and calls io.write to output it.



32
33
34
35
36
37
38
# File 'lib/minitest/reporters/json_reporter.rb', line 32

def report
  super

  @storage = to_h
  # formate @storage as JSON and write to output stream
  io.write(JSON.dump(@storage))
end