Class: Test::Reporters::Tapj

Inherits:
AbstractHash show all
Defined in:
lib/rubytest/format/tapj.rb

Overview

TAP-J Reporter

Writes the run as a TAP-J stream (revision 5): a line of JSON for the suite, each case, each test and the final tally.

Constant Summary collapse

REVISION =
5

Instance Attribute Summary

Attributes inherited from Abstract

#runner

Instance Method Summary collapse

Methods inherited from AbstractHash

#begin_test, #capture_output?, #end_case, #end_test, #finish, #record

Methods inherited from Abstract

#begin_test, #end_case, #end_test, inherited, registry

Constructor Details

#initialize(runner, output: $stdout) ⇒ Tapj

Returns a new instance of Tapj.



15
16
17
18
19
# File 'lib/rubytest/format/tapj.rb', line 15

def initialize(runner, output: $stdout)
  require 'json'
  super(runner)
  @output = output
end

Instance Method Details

#begin_case(test_case) ⇒ Object



27
28
29
# File 'lib/rubytest/format/tapj.rb', line 27

def begin_case(test_case)
  emit super(test_case)
end

#begin_suite(suite) ⇒ Object



22
23
24
# File 'lib/rubytest/format/tapj.rb', line 22

def begin_suite(suite)
  emit super(suite).merge('rev' => REVISION)
end

#end_suite(suite) ⇒ Object



62
63
64
# File 'lib/rubytest/format/tapj.rb', line 62

def end_suite(suite)
  emit super(suite)
end

#error(test, exception) ⇒ Object



42
43
44
# File 'lib/rubytest/format/tapj.rb', line 42

def error(test, exception)
  emit super(test, exception)
end

#fail(test, exception) ⇒ Object



37
38
39
# File 'lib/rubytest/format/tapj.rb', line 37

def fail(test, exception)
  emit super(test, exception)
end

#pass(test) ⇒ Object



32
33
34
# File 'lib/rubytest/format/tapj.rb', line 32

def pass(test)
  emit super(test)
end

#skip_case(test_case, reason = nil) ⇒ Object



57
58
59
# File 'lib/rubytest/format/tapj.rb', line 57

def skip_case(test_case, reason=nil)
  emit super(test_case, reason)
end

#skip_test(test, reason = nil) ⇒ Object



52
53
54
# File 'lib/rubytest/format/tapj.rb', line 52

def skip_test(test, reason=nil)
  emit super(test, reason)
end

#todo(test, exception) ⇒ Object



47
48
49
# File 'lib/rubytest/format/tapj.rb', line 47

def todo(test, exception)
  emit super(test, exception)
end