turbo_tests 2.2.1 → 2.2.2

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: 57c5760443437107ad7196dc007bfaf775cf3e46769d8ddb4987f94e34815da8
4
- data.tar.gz: d1451ded6e8f89f265d33ac1d189e4521d89d8b269b3fe006fef262e60b8ec51
3
+ metadata.gz: 5ee7cf1d2645f6c5d1ab7088ad50f239269c302d05adf783640976389c7366ad
4
+ data.tar.gz: 5e8e203558a4a6d04fa16f3335114fe626df75bc21cd4c92d9a7e7e9fca53e04
5
5
  SHA512:
6
- metadata.gz: 5e22474b8d65b2a9014ee9395a8f9f9bd9ec5ceaace42ef4905fe3d2011346ac2042d7c33a8924cb7264bc93433013a79660fc4ff1024d9cf16c5729afe28217
7
- data.tar.gz: 749069b2de3464f7cf348cf1af6e674acaebc4c9a1b3cb3bf905f6883175489c855796d8618bafb1a600398bc9222bc6b240a0809560acc2686dba57107cbf7b
6
+ metadata.gz: 65511e7eae9bf5a2dc40be0c39f7d0f970a40196f2c52791d0a87231606e078cc922d51b83285c50e7f7fedafb95a05a613ee6691f927dcf9c3756dd00009685
7
+ data.tar.gz: c6cc417e63a8385d7f25e245e9a923a16588b3d8099645f049de905041e61f43fe96d0f58145a81e1d357038dbaa3fe72d5622451720a997e1c2027162387491
@@ -13,7 +13,8 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: true
15
15
  matrix:
16
- ruby: [ 2.7, "3.0", 3.1, 3.2 ]
16
+ ruby: [ 2.7, "3.0", 3.1, 3.2, 3.3 ]
17
+ os: [ ubuntu-latest, windows-latest ]
17
18
 
18
19
  steps:
19
20
  - uses: actions/checkout@v3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_tests (2.2.1)
4
+ turbo_tests (2.2.2)
5
5
  json (~> 2.3)
6
6
  parallel_tests (>= 3.3.0, < 5)
7
7
  rspec (>= 3.10)
@@ -164,7 +164,7 @@ module TurboTests
164
164
  end
165
165
 
166
166
  def output_row(obj)
167
- output.puts(obj.to_json)
167
+ output.puts ENV["RSPEC_FORMATTER_OUTPUT_ID"] + obj.to_json
168
168
  output.flush
169
169
  end
170
170
  end
@@ -24,7 +24,7 @@ module TurboTests
24
24
  seed_used = !opts[:seed].nil?
25
25
 
26
26
  if verbose
27
- STDERR.puts "VERBOSE"
27
+ warn "VERBOSE"
28
28
  end
29
29
 
30
30
  reporter = Reporter.from_config(formatters, start_time)
@@ -134,19 +134,19 @@ module TurboTests
134
134
  if tests.empty?
135
135
  @messages << {
136
136
  type: "exit",
137
- process_id: process_id
137
+ process_id: process_id,
138
138
  }
139
139
  else
140
- tmp_filename = "tmp/test-pipes/subprocess-#{process_id}"
141
-
142
- begin
143
- File.mkfifo(tmp_filename)
144
- rescue Errno::EEXIST
145
- end
146
-
140
+ env["RSPEC_FORMATTER_OUTPUT_ID"] = SecureRandom.uuid
147
141
  env["RUBYOPT"] = ["-I#{File.expand_path("..", __dir__)}", ENV["RUBYOPT"]].compact.join(" ")
148
142
  env["RSPEC_SILENCE_FILTER_ANNOUNCEMENTS"] = "1"
149
143
 
144
+ if ENV["BUNDLE_BIN_PATH"]
145
+ command_name = [ENV["BUNDLE_BIN_PATH"], "exec", "rspec"]
146
+ else
147
+ command_name = "rspec"
148
+ end
149
+
150
150
  record_runtime_options =
151
151
  if record_runtime
152
152
  [
@@ -158,23 +158,23 @@ module TurboTests
158
158
  end
159
159
 
160
160
  command = [
161
- "rspec",
161
+ *command_name,
162
162
  *extra_args,
163
- "--seed", @seed,
163
+ "--seed", rand(0xFFFF).to_s,
164
+ "--format", "ParallelTests::RSpec::RuntimeLogger",
165
+ "--out", @runtime_log,
164
166
  "--format", "TurboTests::JsonRowsFormatter",
165
- "--out", tmp_filename,
166
167
  *record_runtime_options,
167
- *tests
168
+ *tests,
168
169
  ]
169
- command.unshift(ENV["BUNDLE_BIN_PATH"], "exec") if ENV["BUNDLE_BIN_PATH"]
170
170
 
171
171
  if @verbose
172
172
  command_str = [
173
173
  env.map { |k, v| "#{k}=#{v}" }.join(" "),
174
- command.join(" ")
174
+ command.join(" "),
175
175
  ].select { |x| x.size > 0 }.join(" ")
176
176
 
177
- STDERR.puts "Process #{process_id}: #{command_str}"
177
+ warn "Process #{process_id}: #{command_str}"
178
178
  end
179
179
 
180
180
  stdin, stdout, stderr, wait_thr = Open3.popen3(env, *command)
@@ -182,26 +182,30 @@ module TurboTests
182
182
 
183
183
  @threads <<
184
184
  Thread.new do
185
- File.open(tmp_filename) do |fd|
186
- fd.each_line do |line|
187
- message = JSON.parse(line, symbolize_names: true)
185
+ stdout.each_line do |line|
186
+ result = line.split(env["RSPEC_FORMATTER_OUTPUT_ID"])
187
+
188
+ output = result.shift
189
+ print(output) unless output.empty?
190
+
191
+ message = result.shift
192
+ next unless message
188
193
 
189
- message[:process_id] = process_id
190
- @messages << message
191
- end
194
+ message = JSON.parse(message, symbolize_names: true)
195
+ message[:process_id] = process_id
196
+ @messages << message
192
197
  end
193
198
 
194
- @messages << {type: "exit", process_id: process_id}
199
+ @messages << { type: "exit", process_id: process_id }
195
200
  end
196
201
 
197
- @threads << start_copy_thread(stdout, STDOUT)
198
202
  @threads << start_copy_thread(stderr, STDERR)
199
203
 
200
- @threads << Thread.new {
204
+ @threads << Thread.new do
201
205
  unless wait_thr.value.success?
202
- @messages << {type: "error"}
206
+ @messages << { type: "error" }
203
207
  end
204
- }
208
+ end
205
209
 
206
210
  wait_thr
207
211
  end
@@ -1,3 +1,3 @@
1
1
  module TurboTests
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
data/lib/turbo_tests.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "securerandom"
3
4
  require "open3"
4
5
  require "fileutils"
5
- require "ostruct"
6
6
  require "json"
7
+
7
8
  require "rspec"
8
9
 
9
10
  require "parallel_tests"
@@ -1,9 +1,7 @@
1
1
  module CoreExtensions
2
2
  refine Hash do
3
3
  def to_struct
4
- OpenStruct.new(self.each_with_object({}) do |(key, val), acc|
5
- acc[key] = val.is_a?(Hash) ? val.to_struct : val
6
- end)
4
+ Struct.new(*self.keys).new(*self.values.map { |value| value.is_a?(Hash) ? value.to_struct : value })
7
5
  end
8
6
  end
9
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Illia Zub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-10 00:00:00.000000000 Z
11
+ date: 2024-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec