single_cov 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/single_cov/version.rb +1 -1
- data/lib/single_cov.rb +17 -3
- 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: f2cf305464b1da18b681573d4e895ba407a3205665d17b2a6ebb344dfcf53d0c
|
4
|
+
data.tar.gz: baaf64ed79b78aaea3b4d19a60d4f068f38bee2473dae5ec7ac7a85392e8b05d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c78ebf762c39a959945fba05bea127029d9594dcdf973e146e47ad9a5d1070e1db4196c2deac23e1c8ce44c886547b25e5f092f19f7b2643fe3b8611f67afab
|
7
|
+
data.tar.gz: 96633f2c63bd2e512a57e45130ce71aacc5d16f4e1636f77be274bfe405be9526728c69ab4d6d14bf9db5a13805cd30ccb6e47690f73db522df52c450d7c7ee2
|
data/lib/single_cov/version.rb
CHANGED
data/lib/single_cov.rb
CHANGED
@@ -12,11 +12,13 @@ module SingleCov
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def not_covered!
|
15
|
+
store_pid
|
15
16
|
end
|
16
17
|
|
17
18
|
def covered!(file: nil, uncovered: 0)
|
18
19
|
file = guess_and_check_covered_file(file)
|
19
20
|
COVERAGES << [file, uncovered]
|
21
|
+
store_pid
|
20
22
|
end
|
21
23
|
|
22
24
|
def all_covered?(result)
|
@@ -27,7 +29,7 @@ module SingleCov
|
|
27
29
|
branch_coverage = (coverage.is_a?(Hash) && coverage[:branches])
|
28
30
|
|
29
31
|
if branch_coverage
|
30
|
-
uncovered.concat uncovered_branches(
|
32
|
+
uncovered.concat uncovered_branches(branch_coverage, uncovered)
|
31
33
|
end
|
32
34
|
|
33
35
|
next if uncovered.size == expected_uncovered
|
@@ -110,7 +112,7 @@ module SingleCov
|
|
110
112
|
start_coverage_recording
|
111
113
|
|
112
114
|
override_at_exit do |status, _exception|
|
113
|
-
exit 1 if
|
115
|
+
exit 1 if enabled? && main_process? && status == 0 && !SingleCov.all_covered?(coverage_results)
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
@@ -121,7 +123,19 @@ module SingleCov
|
|
121
123
|
|
122
124
|
private
|
123
125
|
|
124
|
-
def
|
126
|
+
def enabled?
|
127
|
+
(!defined?(@disabled) || !@disabled)
|
128
|
+
end
|
129
|
+
|
130
|
+
def store_pid
|
131
|
+
@pid = Process.pid
|
132
|
+
end
|
133
|
+
|
134
|
+
def main_process?
|
135
|
+
(!defined?(@pid) || @pid == Process.pid)
|
136
|
+
end
|
137
|
+
|
138
|
+
def uncovered_branches(coverage, uncovered_lines)
|
125
139
|
# {[branch_id] => {[branch_part] => coverage}} --> {branch_part -> sum-of-coverage}
|
126
140
|
sum = Hash.new(0)
|
127
141
|
coverage.each_value do |branch|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: single_cov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.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: 2018-
|
11
|
+
date: 2018-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|