blinka-reporter 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d84bd0f016744a88e06403d6f01f730004bf3cfb31b36394174f1335c12cd103
4
- data.tar.gz: 3ab3b1744b8be12c29227e080ed0a39e6039ff63e0e883063d21b5c80a212290
3
+ metadata.gz: 18126165bf1e12fccca242964c2086abcab1ad37f1ca6b089b5e02edcb0a64b5
4
+ data.tar.gz: fc47b4d956f56d7c7572e8fd11b4cd9d119d4e14929ac6f73ba35ee20a66abfd
5
5
  SHA512:
6
- metadata.gz: cd1ee46a25fb0c799ae89054c6b835f11aea3883420320d5809160b2315ad1eb93640aea7588b1509fb744c79dc7fb6a5a35b3b47ba493cdc81b2bcb65ee671a
7
- data.tar.gz: 97c433c7f79f60e8441376f47fcc9d937e2d1c02db93d67793655aed288d0367eea13d02fa1a7833ff6a299611e3c971f121d8b5169cc7d0f2dcf4b93e0cde73
6
+ metadata.gz: d362519ba45683ad4cddc22c9fbe7e2f5f72e4281ff5369bda0056789b90ae77d3ddf529728a7c5b305d55a633e719a297e6389c79e4f923138311be1777ce75
7
+ data.tar.gz: 34416bc8b028746deb93b11a684cfed331c0f7fcb0b0210cc216721faec0c41d99caf3b335a9750db3bc11c131850f04964372b50481a680a6cf1368ee7a1649
data/lib/blinka_client.rb CHANGED
@@ -7,23 +7,13 @@ class BlinkaClient
7
7
  include HTTParty
8
8
 
9
9
  class BlinkaConfig
10
- attr_reader(
11
- :tag,
12
- :commit,
13
- :host,
14
- :repository,
15
- :team_id,
16
- :team_secret,
17
- :jwt_token
18
- )
10
+ attr_reader(:host, :repository, :team_id, :team_secret, :jwt_token)
19
11
 
20
12
  def initialize
21
13
  @host = ENV.fetch('BLINKA_HOST', DEFAULT_HOST)
22
14
  @team_id = ENV.fetch('BLINKA_TEAM_ID', nil)
23
15
  @team_secret = ENV.fetch('BLINKA_TEAM_SECRET', nil)
24
16
  @repository = ENV.fetch('BLINKA_REPOSITORY', nil)
25
- @tag = ENV.fetch('BLINKA_TAG', '')
26
- @commit = BlinkaClient.find_commit
27
17
 
28
18
  if @team_id.nil? || @team_secret.nil? || @repository.nil?
29
19
  raise(BlinkaError, <<~EOS)
@@ -75,13 +65,13 @@ class BlinkaClient
75
65
  body = {
76
66
  report: {
77
67
  repository: @config.repository,
78
- tag: @config.tag,
79
- commit: @config.commit,
68
+ tag: data['tag'],
69
+ commit: data['commit'],
80
70
  metadata: {
81
- total_time: data.dig('total_time'),
82
- nbr_tests: data.dig('nbr_tests'),
83
- nbr_assertions: data.dig('nbr_assertions'),
84
- seed: data.dig('seed')
71
+ total_time: data['total_time'],
72
+ nbr_tests: data['nbr_tests'],
73
+ nbr_assertions: data['nbr_assertions'],
74
+ seed: data['seed']
85
75
  }.compact,
86
76
  results: results
87
77
  }
@@ -98,9 +88,7 @@ class BlinkaClient
98
88
  )
99
89
  case response.code
100
90
  when 200
101
- puts "Reported #{data.dig('nbr_tests')} tests of commit #{
102
- @config.commit
103
- }!"
91
+ puts "Reported #{data['nbr_tests']} tests of commit #{data['commit']}!"
104
92
  else
105
93
  raise(BlinkaError, "Could not report, got response code #{response.code}")
106
94
  end
@@ -198,11 +186,4 @@ class BlinkaClient
198
186
  }
199
187
  }
200
188
  end
201
-
202
- def self.find_commit
203
- ENV.fetch(
204
- 'BLINKA_COMMIT',
205
- ENV.fetch('HEROKU_TEST_RUN_COMMIT_VERSION', `git rev-parse HEAD`.chomp)
206
- )
207
- end
208
189
  end
@@ -0,0 +1,3 @@
1
+ module BlinkaReporter
2
+ VERSION = '0.3.5'.freeze
3
+ end
@@ -26,13 +26,13 @@ module Minitest
26
26
  end
27
27
 
28
28
  def report
29
+ super
30
+
29
31
  tap_report if ENV['BLINKA_TAP']
30
32
  json_report if ENV['BLINKA_JSON'] || ENV['BLINKA_REPORT']
31
33
  BlinkaClient.new.report if ENV['BLINKA_REPORT']
32
34
  rescue BlinkaClient::BlinkaError => error
33
35
  puts(error)
34
- ensure
35
- super
36
36
  end
37
37
 
38
38
  private
@@ -42,6 +42,8 @@ module Minitest
42
42
  total_time: total_time,
43
43
  nbr_tests: count,
44
44
  nbr_assertions: assertions,
45
+ commit: find_commit,
46
+ tag: ENV.fetch('BLINKA_TAG', ''),
45
47
  seed: options[:seed],
46
48
  results:
47
49
  tests.map { |test_result| BlinkaMinitest.new(test_result).report }
@@ -83,6 +85,16 @@ module Minitest
83
85
  def print_padded_comment(line)
84
86
  puts "##{' ' * TAP_COMMENT_PAD + line}"
85
87
  end
88
+
89
+ def find_commit
90
+ ENV.fetch(
91
+ 'BLINKA_COMMIT',
92
+ ENV.fetch(
93
+ 'HEROKU_TEST_RUN_COMMIT_VERSION',
94
+ `git rev-parse HEAD`.chomp
95
+ )
96
+ )
97
+ end
86
98
  end
87
99
  end
88
100
  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.3.4
4
+ version: 0.3.5
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-24 00:00:00.000000000 Z
11
+ date: 2021-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -116,11 +116,17 @@ extra_rdoc_files: []
116
116
  files:
117
117
  - lib/blinka_client.rb
118
118
  - lib/blinka_minitest.rb
119
+ - lib/blinka_reporter/version.rb
119
120
  - lib/minitest/blinka_plugin.rb
120
121
  homepage: https://github.com/davidwessman/blinka_reporter
121
122
  licenses:
122
123
  - MIT
123
- metadata: {}
124
+ metadata:
125
+ homepage_uri: https://github.com/davidwessman/blinka_reporter
126
+ bug_tracker_uri: https://github.com/davidwessman/blinka_reporter/issues
127
+ documentation_uri: https://github.com/davidwessman/blinka_reporter
128
+ changelog_uri: https://github.com/davidwessman/blinka_reporter/main/CHANGELOG.md
129
+ source_code_uri: https://github.com/davidwessman/blinka_reporter
124
130
  post_install_message:
125
131
  rdoc_options: []
126
132
  require_paths: