blinka-reporter 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blinka_client.rb +7 -5
- data/lib/minitest/blinka_plugin.rb +38 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4c4ccf6dd86400f02f520904fe168fcfe7530db71966b818844a0295369a50
|
4
|
+
data.tar.gz: 34ef6d0a3c4ff1a1b8bd2c9f1fb62f139db83179c1665113ff2297c589f29547
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564f1f7b0088fcb2465e9a950e22cf1cfd2d7e6c8d4cbcc35cfb8392e4f7896587bf1a7432f42028474f39037b49d17adc29416b7e431f29bb22079c2e556b2f
|
7
|
+
data.tar.gz: 3ad6f5d44f1851e4cbba08e601270939b1922f92cf47a5d722a9b299fa0d304ceb10afd70c669986075304b16cd11897b2faddc0540618e25ef5214faf2868fa
|
data/lib/blinka_client.rb
CHANGED
@@ -4,7 +4,7 @@ require 'httparty'
|
|
4
4
|
class BlinkaClient
|
5
5
|
class BlinkaConfig
|
6
6
|
attr_reader(
|
7
|
-
:
|
7
|
+
:tag,
|
8
8
|
:commit,
|
9
9
|
:host,
|
10
10
|
:repository,
|
@@ -17,8 +17,8 @@ class BlinkaClient
|
|
17
17
|
@team_id = ENV.fetch('BLINKA_TEAM_ID')
|
18
18
|
@team_secret = ENV.fetch('BLINKA_TEAM_SECRET')
|
19
19
|
@repository = ENV.fetch('BLINKA_REPOSITORY')
|
20
|
-
@
|
21
|
-
@commit = `git rev-parse HEAD`.chomp
|
20
|
+
@tag = ENV.fetch('BLINKA_TAG', '')
|
21
|
+
@commit = ENV.fetch('BLINKA_COMMIT', `git rev-parse HEAD`.chomp)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -50,7 +50,7 @@ class BlinkaClient
|
|
50
50
|
body = {
|
51
51
|
report: {
|
52
52
|
repository: @config.repository,
|
53
|
-
|
53
|
+
tag: @config.tag,
|
54
54
|
commit: @config.commit,
|
55
55
|
metadata: {
|
56
56
|
total_time: data.dig('total_time'),
|
@@ -73,7 +73,9 @@ class BlinkaClient
|
|
73
73
|
)
|
74
74
|
case response.code
|
75
75
|
when 200
|
76
|
-
puts "Reported #{data.dig('nbr_tests')} tests
|
76
|
+
puts "Reported #{data.dig('nbr_tests')} tests of commit #{
|
77
|
+
@config.commit
|
78
|
+
}!"
|
77
79
|
else
|
78
80
|
raise(BlinkaError, "Could not report, got response code #{response.code}")
|
79
81
|
end
|
@@ -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.0
|
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-
|
11
|
+
date: 2021-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -103,7 +103,7 @@ files:
|
|
103
103
|
- lib/blinka_client.rb
|
104
104
|
- lib/blinka_minitest.rb
|
105
105
|
- lib/minitest/blinka_plugin.rb
|
106
|
-
homepage: https://
|
106
|
+
homepage: https://github.com/davidwessman/blinka_reporter
|
107
107
|
licenses:
|
108
108
|
- MIT
|
109
109
|
metadata: {}
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.2.7
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Format tests for Blinka
|