forking_test_runner 1.12.0 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/forking_test_runner/version.rb +1 -1
- data/lib/forking_test_runner.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d802108391cd0edbb4c9a9628ca56d447dbc07992f07cf8c1ffc1e61d770d5a
|
4
|
+
data.tar.gz: cabbf4e263465b03e1bc47435b15ce5186c3478f409095f57d2197e49ca5e0e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 921396a5eec38e183f71ab4ba42340dad7c34f81d622af12ad9df156c639ce0c41d53ba0bcaff9c3e5efa6e52d5416a1676a018f6cacb1e4aa01fb820d338781
|
7
|
+
data.tar.gz: c79fcf65d60af55227c194baf05c86275a1d6d2b1132fa14bd311480d982b490b40d991c02f8a14ad9a95f7578fbd92ee1b6f7a7e32108dc9a853c4d92594f90
|
data/lib/forking_test_runner.rb
CHANGED
@@ -11,6 +11,9 @@ module ForkingTestRunner
|
|
11
11
|
CONVERAGE_REPORT_PREFIX = "coverage/fork-"
|
12
12
|
|
13
13
|
class << self
|
14
|
+
|
15
|
+
attr_accessor :before_fork_callbacks, :after_fork_callbacks
|
16
|
+
|
14
17
|
def cli(argv)
|
15
18
|
@options, tests = CLI.parse_options(argv)
|
16
19
|
|
@@ -34,6 +37,9 @@ module ForkingTestRunner
|
|
34
37
|
puts "Running tests #{all_tests.map(&:first).join(" ")}"
|
35
38
|
end
|
36
39
|
|
40
|
+
@before_fork_callbacks = []
|
41
|
+
@after_fork_callbacks = []
|
42
|
+
|
37
43
|
# run all the tests
|
38
44
|
results = with_lock do |lock|
|
39
45
|
Parallel.map_with_index(test_groups, in_processes: parallel || 0) do |tests, env_index|
|
@@ -195,6 +201,7 @@ module ForkingTestRunner
|
|
195
201
|
preload_fixtures
|
196
202
|
ActiveRecord::Base.connection.disconnect!
|
197
203
|
end
|
204
|
+
@before_fork_callbacks.each(&:call)
|
198
205
|
|
199
206
|
CoverageCapture.capture! if @options.fetch(:merge_coverage)
|
200
207
|
end
|
@@ -289,6 +296,9 @@ module ForkingTestRunner
|
|
289
296
|
if partial_reports_for_single_cov?
|
290
297
|
SingleCov.coverage_report = "#{CONVERAGE_REPORT_PREFIX}#{Process.pid}.json"
|
291
298
|
end
|
299
|
+
|
300
|
+
@after_fork_callbacks.each(&:call)
|
301
|
+
|
292
302
|
if active_record?
|
293
303
|
key = (ActiveRecord::VERSION::STRING >= "4.1.0" ? :test : "test")
|
294
304
|
ActiveRecord::Base.establish_connection key
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forking_test_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel_tests
|