blinka-reporter 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/minitest/blinka_plugin.rb +38 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a26795f0deaada3c12bef38c660e45cca49b277362306eb199da070d4f65d28
4
- data.tar.gz: 442cad020224f803c87deb42ded273fae7c0335858f3c3e8a641480bea21ed4c
3
+ metadata.gz: 9e4c4ccf6dd86400f02f520904fe168fcfe7530db71966b818844a0295369a50
4
+ data.tar.gz: 34ef6d0a3c4ff1a1b8bd2c9f1fb62f139db83179c1665113ff2297c589f29547
5
5
  SHA512:
6
- metadata.gz: 1ba2584c0cbd1540246a7d1720e97340b390509ecae76642ce90ff443fde11e32719f21d820d1e0454ff9d1c9f341b8f4c82b3424529287cb4d85b8b5e05fd7d
7
- data.tar.gz: 47ef061a1734215bdb0d17087fcb1412ed081a57c6b27b764e4a2a15372feda09f759dadfc3e435e8fe9cde513ed1cd034f91be74534cb7853bb1fa19e52556f
6
+ metadata.gz: 564f1f7b0088fcb2465e9a950e22cf1cfd2d7e6c8d4cbcc35cfb8392e4f7896587bf1a7432f42028474f39037b49d17adc29416b7e431f29bb22079c2e556b2f
7
+ data.tar.gz: 3ad6f5d44f1851e4cbba08e601270939b1922f92cf47a5d722a9b299fa0d304ceb10afd70c669986075304b16cd11897b2faddc0540618e25ef5214faf2868fa
@@ -10,6 +10,7 @@ module Minitest
10
10
  def plugin_blinka_options(opts, options); end
11
11
 
12
12
  module BlinkaPlugin
13
+ TAP_COMMENT_PAD = 8
13
14
  class Reporter < Minitest::StatisticsReporter
14
15
  attr_accessor :tests
15
16
 
@@ -24,8 +25,15 @@ module Minitest
24
25
  end
25
26
 
26
27
  def report
28
+ tap_report unless ENV['BLINKA_TAP'].nil?
29
+ blinka_report
30
+
27
31
  super
32
+ end
33
+
34
+ private
28
35
 
36
+ def blinka_report
29
37
  result = {
30
38
  total_time: total_time,
31
39
  nbr_tests: count,
@@ -41,6 +49,36 @@ module Minitest
41
49
  puts
42
50
  puts('Test results written to `./blinka_results.json`')
43
51
  end
52
+
53
+ # Based on https://github.com/kern/minitest-reporters/blob/master/lib/minitest/reporters/progress_reporter.rb
54
+ # Tries to adhere to https://testanything.org/tap-specification.html
55
+ def tap_report
56
+ puts
57
+ puts('TAP version 13')
58
+ puts("1..#{tests.length}")
59
+ tests.each_with_index do |test, index|
60
+ blinka = BlinkaMinitest.new(test)
61
+ test_str = "#{blinka.path} - #{test.name.tr('#', '_')}"
62
+ if test.passed?
63
+ puts "ok #{index + 1} - #{test_str}"
64
+ elsif test.skipped?
65
+ puts "ok #{index + 1} # skip: #{test_str}"
66
+ elsif test.failure
67
+ puts "not ok #{index + 1} - failed: #{test_str}"
68
+ blinka.message.each_line { |line| print_padded_comment(line) }
69
+
70
+ # test.failure.message.each_line { |line| print_padded_comment(line) }
71
+ unless test.failure.is_a?(MiniTest::UnexpectedError)
72
+ blinka.backtrace.each { |line| print_padded_comment(line) }
73
+ end
74
+ puts
75
+ end
76
+ end
77
+ end
78
+
79
+ def print_padded_comment(line)
80
+ puts "##{' ' * TAP_COMMENT_PAD + line}"
81
+ end
44
82
  end
45
83
  end
46
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinka-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Wessman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2021-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty