turbo_tests 2.2.0 → 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: 4333741571516dc714d516eac90fb9cf56236b7084935e9ebdfa313becf842d5
4
- data.tar.gz: 56c3df79a128084822f5bb88de6500bc6e3e254041609a6329b7b587f180298b
3
+ metadata.gz: 5ee7cf1d2645f6c5d1ab7088ad50f239269c302d05adf783640976389c7366ad
4
+ data.tar.gz: 5e8e203558a4a6d04fa16f3335114fe626df75bc21cd4c92d9a7e7e9fca53e04
5
5
  SHA512:
6
- metadata.gz: f9e1d084a510a334be437dcc200d496118e05b65b7b61730dfe8b1de3b90014de73f7108754a8fc3caac216bbebdec858798d2a798db43a87bb2f2fdd108edb6
7
- data.tar.gz: 8fc6250f94c926eacbebca503a90640ed30998430a54ed31bf97d8bfc090b92f35202a043dbe08f28c42432fd9f300c7ba357d3bd3ee17daa95ea0adc3e457cc
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,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_tests (2.2.0)
4
+ turbo_tests (2.2.2)
5
+ json (~> 2.3)
5
6
  parallel_tests (>= 3.3.0, < 5)
6
7
  rspec (>= 3.10)
7
8
 
@@ -10,6 +11,7 @@ GEM
10
11
  specs:
11
12
  coderay (1.1.3)
12
13
  diff-lcs (1.5.0)
14
+ json (2.7.2)
13
15
  method_source (1.0.0)
14
16
  parallel (1.22.1)
15
17
  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.0"
2
+ VERSION = "2.2.2"
3
3
  end
data/lib/turbo_tests.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "securerandom"
3
4
  require "open3"
4
5
  require "fileutils"
5
6
  require "json"
7
+
6
8
  require "rspec"
7
9
 
8
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,6 +21,7 @@ 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"
24
25
 
25
26
  spec.add_development_dependency "pry", "~> 0.14"
26
27
 
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.0
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: 2023-09-29 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,6 +44,20 @@ 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'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: pry
49
63
  requirement: !ruby/object:Gem::Requirement