turbo_tests 2.2.1 → 2.2.3

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: 8839d105f1c8a6011d5d9796b22d39c56ec2a419afadde707bd4efa01892e2c3
4
+ data.tar.gz: 861501c3f6f15e7d1baa0ad823a0602d99eb46ff5ec577ef3cd39b9ed1fe3657
5
5
  SHA512:
6
- metadata.gz: 5e22474b8d65b2a9014ee9395a8f9f9bd9ec5ceaace42ef4905fe3d2011346ac2042d7c33a8924cb7264bc93433013a79660fc4ff1024d9cf16c5729afe28217
7
- data.tar.gz: 749069b2de3464f7cf348cf1af6e674acaebc4c9a1b3cb3bf905f6883175489c855796d8618bafb1a600398bc9222bc6b240a0809560acc2686dba57107cbf7b
6
+ metadata.gz: 02d41594c07d5e6aeb35d7eddabacb1052a1677d17e41ee86a092c7226f411ca59cce785efc0321073140940390458976fd3231e83de4ff6ed35b25561358639
7
+ data.tar.gz: 5404af69067ca602dad75aece1d1b4476ecc72a3b380e37df79ed91dce8a8968fee76d41a347fca7de8a839f5db438790010b5fee2a0b493f653c256da3dd793
@@ -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,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_tests (2.2.1)
5
- json (~> 2.3)
4
+ turbo_tests (2.2.3)
6
5
  parallel_tests (>= 3.3.0, < 5)
7
6
  rspec (>= 3.10)
8
7
 
@@ -11,7 +10,6 @@ GEM
11
10
  specs:
12
11
  coderay (1.1.3)
13
12
  diff-lcs (1.5.0)
14
- json (2.7.2)
15
13
  method_source (1.0.0)
16
14
  parallel (1.22.1)
17
15
  parallel_tests (4.2.0)
@@ -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.3"
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
- end
7
+ end
data/turbo_tests.gemspec CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "rspec", ">= 3.10"
23
23
  spec.add_dependency "parallel_tests", ">= 3.3.0", "< 5"
24
- spec.add_dependency "json", "~> 2.3"
25
24
 
26
25
  spec.add_development_dependency "pry", "~> 0.14"
27
26
 
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.3
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
@@ -44,20 +44,6 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '5'
47
- - !ruby/object:Gem::Dependency
48
- name: json
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '2.3'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '2.3'
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: pry
63
49
  requirement: !ruby/object:Gem::Requirement