fast_ci 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c198e20b22117ce90305fa7c2f82c512ef268097b46c63fcb9cdfaaa9c45aa1d
4
- data.tar.gz: cede75f91ab2fad8ee74715660a273ed9a0f229f40beb0875b4edc6ae253d550
3
+ metadata.gz: cde3318f98f75d587d3151007dd38a0336106709b3df12bc971fc720275adc64
4
+ data.tar.gz: a600f3f55cdf8c479b9b9f555e3a9818d2a26113af146994c5ce809c38b928da
5
5
  SHA512:
6
- metadata.gz: 04040e4fff496fe2065fc2f120160fc29f253322abe3f6f526f9516e88bd9feb98ddb1319ce161858f204eacc2c59d6dccd2390645b1f168e254a91ad1ccb89e
7
- data.tar.gz: 168c07fddb1154357fa647d5d59e61a8a248206f933a96f437ff4ac8d2a485b56c8b15b0cecc05a9974ad181d8cff8cc999129767ae92de4993c6ea20fdbd40c
6
+ metadata.gz: 654096c3ac8764a47cf7122a66e6b931fe349fffea27e37cbe1875de914efe9d3acad2fe319783fbd0c0651099fb23e510324ad399b8835980b58b070be7e65e
7
+ data.tar.gz: fe743b69df08bd40150ad3d09a93e468b81217a36462d5c3e872db32351aa9b74ed11dad06e70f8574cb211cf5e32ac38e573d5e3681b4e0682e0d14d8590632
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- fast_ci (1.1.0)
14
+ fast_ci (1.1.1)
15
15
  async-websocket (<= 0.20.0)
16
16
  brakeman (>= 5.4.1)
17
17
  console (>= 1.10.0)
@@ -80,7 +80,7 @@ GEM
80
80
  diff-lcs (1.5.0)
81
81
  docile (1.4.1)
82
82
  equalizer (0.0.11)
83
- erubi (1.13.0)
83
+ erubi (1.13.1)
84
84
  fiber-local (1.0.0)
85
85
  flay (2.13.3)
86
86
  erubi (~> 1.10)
@@ -98,13 +98,13 @@ GEM
98
98
  launchy (3.0.1)
99
99
  addressable (~> 2.8)
100
100
  childprocess (~> 5.0)
101
- logger (1.6.1)
101
+ logger (1.6.4)
102
102
  loofah (2.23.1)
103
103
  crass (~> 1.0.2)
104
104
  nokogiri (>= 1.12.0)
105
105
  method_source (1.0.0)
106
- mini_portile2 (2.8.7)
107
- minitest (5.25.1)
106
+ mini_portile2 (2.8.8)
107
+ minitest (5.25.4)
108
108
  minitest-rails (6.1.1)
109
109
  minitest (~> 5.10)
110
110
  railties (~> 6.1.0)
@@ -179,7 +179,7 @@ GEM
179
179
  simplecov (>= 0.17.0)
180
180
  tty-which (~> 0.4.0)
181
181
  virtus (~> 1.0)
182
- sexp_processor (4.17.2)
182
+ sexp_processor (4.17.3)
183
183
  simplecov (0.22.0)
184
184
  docile (~> 1.1)
185
185
  simplecov-html (~> 0.11)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastCI
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
@@ -3,6 +3,45 @@ require_relative "reporters/fastci_reporter"
3
3
  module Minitest
4
4
  def self.plugin_fastci_init(options)
5
5
  if ENV['FAST_CI_SECRET_KEY'].present?
6
+ FastCI.configure { |c| c.run_key = "minitest" }
7
+ Minitest.class_eval do
8
+ class<< self
9
+ def __run reporter, options
10
+ suites = Minitest::Runnable.runnables
11
+ tests = {}
12
+ suit_paths = {}
13
+ suites.each do |suite|
14
+ path = "./#{Object.const_source_location(suite.name)[0].gsub(Regexp.new("^#{::Rails.root}/"), '')}"
15
+ next if path.starts_with?('./vendor/bundle')
16
+ tests[path] ||= { run_time: 0.0, file_status: 'pending', test_count: suite.runnable_methods.count, test_counters: { failed: 0, passed: 0, pending: 0 }, '1' => {} }
17
+ suit_paths[path] = suite
18
+ suite.runnable_methods.each_with_index do |method, ix|
19
+ description = method.split(':')[1..-1].join(':')
20
+ tests[path]['1'][(ix + 1).to_s] ||= { status: 'pending', description: description }
21
+ end
22
+ end
23
+
24
+ FastCI.minitest_ws.on(:enq_request) do
25
+ tests
26
+ end
27
+
28
+ FastCI.minitest_ws.on(:deq) do |api_tests|
29
+ run_suites = api_tests.map do |test_path|
30
+ suit_paths[test_path]
31
+ end
32
+ parallel, serial = run_suites.partition { |s| s.test_order == :parallel }
33
+
34
+ serial.map { |suite| suite.run reporter, options }
35
+ parallel.map { |suite| suite.run reporter, options }
36
+
37
+ fc_reporter = reporter.report.select {|r| r.class == Minitest::Reporters::FastCIReporter }.first
38
+ fc_reporter.test_results
39
+ end
40
+ FastCI.minitest_await
41
+ end
42
+ end
43
+ end
44
+
6
45
  Minitest.reporter << Minitest::Reporters::FastCIReporter.new
7
46
  end
8
47
  end
@@ -31,18 +31,6 @@ module Minitest
31
31
  @test_results = {}
32
32
  @ids = {}
33
33
  @events = []
34
-
35
- $stdout = StringIO.new()
36
-
37
- if ENV['RBCI_REMOTE_TESTS'] != 'true'
38
- FastCI.minitest_ws.on(:enq_request) do
39
- tests
40
- end
41
-
42
- FastCI.minitest_ws.on(:deq) do |api_tests|
43
- test_results
44
- end
45
- end
46
34
  end
47
35
 
48
36
  def start
@@ -63,20 +51,18 @@ module Minitest
63
51
  end
64
52
 
65
53
  def before_test(test)
66
- $stdout = StringIO.new()
67
54
  end
68
55
 
69
56
  def prerecord(klass, name)
70
57
  description = test_description(name)
71
58
  path = test_path(klass.name)
72
59
 
73
- test_results[path] ||= { run_time: 0.0, file_status: 'pending', test_count: 0, test_counters: { failed: 0, passed: 0, pending: 0 }, '1' => { description: klass.name } }
74
- test_results[path][:test_count] += 1
60
+ test_results[path] ||= { '1' => {} }
75
61
 
76
62
  id = (test_results[path]['1'].keys.size + 1).to_s
77
63
  ids[description] = id
78
64
 
79
- test_results[path]['1'][id] ||= { status: 'pending', description: description }
65
+ test_results[path]['1'][id] ||= { status: 'pending' }
80
66
  test_results[path]['1'][id][:start] = Minitest.clock_time
81
67
 
82
68
  tests[path] ||= { run_time: 0.0, file_status: 'pending', test_count: 0, test_counters: { failed: 0, passed: 0, pending: 0 }, '1' => {} }
@@ -85,7 +71,6 @@ module Minitest
85
71
  end
86
72
 
87
73
  def record(result)
88
- test_finished(result)
89
74
  description = test_description(result.name)
90
75
  id = ids[description]
91
76
  path = test_path(result.klass)
@@ -93,8 +78,8 @@ module Minitest
93
78
  test_results[path]['1'][id][:end] = Minitest.clock_time
94
79
  test_results[path]['1'][id][:run_time] = test_results[path]['1'][id][:end] - test_results[path]['1'][id][:start]
95
80
  test_results[path]['1'][id][:status] = result_status(result).to_s
96
- test_results[path][:test_counters][result_status(result)] += 1
97
- test_results[path][:run_time] += test_results[path]['1'][id][:run_time]
81
+ test_results[path]['1'][id].delete(:start)
82
+ test_results[path]['1'][id].delete(:end)
98
83
  end
99
84
 
100
85
  def report
@@ -108,13 +93,6 @@ module Minitest
108
93
  file_status = 'failed'
109
94
  end
110
95
  end
111
- test_results[path][:file_status] = file_status
112
- end
113
-
114
- if ENV['RBCI_REMOTE_TESTS'] == 'true'
115
- send_events
116
- else
117
- FastCI.minitest_await
118
96
  end
119
97
  end
120
98
 
@@ -131,16 +109,7 @@ module Minitest
131
109
  end
132
110
  end
133
111
 
134
- pass = results.any? {|reult| !result }
135
-
136
- if pass
137
- @events << ['run_minitest'.upcase, { succeed_after: 1 }]
138
- else
139
- @events << ['run_minitest'.upcase, { failed_after: 1 }]
140
- end
141
- send_events if ENV['RBCI_REMOTE_TESTS'] == 'true'
142
-
143
- return pass
112
+ return results.any? {|reult| !result }
144
113
  end
145
114
 
146
115
  def method_missing(method, *args)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nesha Zoric
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2024-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: console