forking_test_runner 1.1.0 → 1.2.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.rb +42 -15
- data/lib/forking_test_runner/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20b5dbbcbf7a0eccd84759792ee55fc23df3f532
|
4
|
+
data.tar.gz: 60bb004e09edc70351417d004c48a744c4ffae5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9805ac39da7d1a475e56c7b3054534d3258509e11d1938c1c2b3a788a822221cd5339124f80348bf0700ddfb7ef809e69d6d6a8995531227ead0185d245b5210
|
7
|
+
data.tar.gz: 3e7e2728ed1603e89765e112bd275480364051b88ef080ba5bb45a89958fa7aed1ce90bc491ffead1a1b0c67d3a4230e5faa43e8774ca073138bc5d2002256a9
|
data/lib/forking_test_runner.rb
CHANGED
@@ -13,26 +13,53 @@ module ForkingTestRunner
|
|
13
13
|
def result
|
14
14
|
original = super
|
15
15
|
return original unless @capture_coverage
|
16
|
+
CoverageCapture.merge_coverage(original, @capture_coverage)
|
17
|
+
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
class << self
|
20
|
+
def merge_coverage(a, b)
|
21
|
+
merged = a.dup
|
22
|
+
b.each do |file, coverage|
|
23
|
+
orig = merged[file]
|
24
|
+
merged[file] = if orig
|
25
|
+
if coverage.is_a?(Array)
|
26
|
+
merge_lines_coverage(orig, coverage)
|
27
|
+
else
|
28
|
+
{
|
29
|
+
lines: merge_lines_coverage(orig.fetch(:lines), coverage.fetch(:lines)),
|
30
|
+
branches: merge_branches_coverage(orig.fetch(:branches), coverage.fetch(:branches))
|
31
|
+
}
|
32
|
+
end
|
33
|
+
else
|
34
|
+
coverage
|
35
|
+
end
|
24
36
|
end
|
37
|
+
merged
|
25
38
|
end
|
26
|
-
merged
|
27
|
-
end
|
28
39
|
|
29
|
-
|
40
|
+
private
|
30
41
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
# assuming b has same or more keys since it comes from a fork
|
43
|
+
# [nil,1,0] + [nil,nil,2] -> [nil,1,2]
|
44
|
+
def merge_lines_coverage(a, b)
|
45
|
+
b.each_with_index.map do |b_count, i|
|
46
|
+
a_count = a[i]
|
47
|
+
(a_count.nil? && b_count.nil?) ? nil : a_count.to_i + b_count.to_i
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# assuming b has same or more keys since it comes from a fork
|
52
|
+
# {foo: {bar: 0, baz: 1}} + {foo: {bar: 1, baz: 0}} -> {foo: {bar: 1, baz: 1}}
|
53
|
+
def merge_branches_coverage(a, b)
|
54
|
+
b.each_with_object({}) do |(branch, v), all|
|
55
|
+
vb = v.dup
|
56
|
+
if part = a[branch]
|
57
|
+
part.each do |nested, a_count|
|
58
|
+
vb[nested] = a_count + vb[nested].to_i
|
59
|
+
end
|
60
|
+
end
|
61
|
+
all[branch] = vb
|
62
|
+
end
|
36
63
|
end
|
37
64
|
end
|
38
65
|
end
|
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.2.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:
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel_tests
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.6.14
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Run every test in a fork to avoid pollution and get clean output per test
|