covered 0.17.1 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/covered/capture.rb +71 -55
- data/lib/covered/persist.rb +2 -7
- data/lib/covered/rspec.rb +1 -1
- data/lib/covered/summary.rb +2 -2
- data/lib/covered/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 016df0cc962d1ae6f41781f31c6e96066b68e7f0b2b6a3740f2e0c4f23e4ea93
|
4
|
+
data.tar.gz: d26da5abf8676d28fe87d8560b6a02f9e114639fecdb8a27bb4a69b62d645440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d4eeb947f26d7d1c48872a8e6706b123c721a80534eb7c5c4447cbe54b7d96605a20832c2c6d8a7611d429a18d5cbf3572973580b757f58d2b3205f5cb569f
|
7
|
+
data.tar.gz: c35ca843c00c9545f8771b9c58622e8076f9af25a188c3c01c3339581e9f87af2f77b0f22ae69301cf2f4f8118269aaf634cbc24d19a4c80329603c9c0a54879
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/covered/capture.rb
CHANGED
@@ -8,69 +8,85 @@ require_relative 'wrapper'
|
|
8
8
|
require 'coverage'
|
9
9
|
|
10
10
|
module Covered
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
def self.coverage_with_eval?
|
12
|
+
if ::Coverage.respond_to?(:supported?)
|
13
|
+
::Coverage.supported?(:eval)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
unless self.coverage_with_eval?
|
18
|
+
class Capture < Wrapper
|
19
|
+
def initialize(output)
|
20
|
+
super(output)
|
21
|
+
|
22
|
+
begin
|
23
|
+
@trace = TracePoint.new(:line, :call, :c_call) do |trace|
|
24
|
+
if trace.event == :call
|
25
|
+
# Ruby doesn't always mark call-sites in sub-expressions, so we use this approach to compute a call site and mark it:
|
26
|
+
if location = caller_locations(2, 1).first and path = location.path
|
27
|
+
@output.mark(path, location.lineno, 1)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if path = trace.path
|
32
|
+
@output.mark(path, trace.lineno, 1)
|
21
33
|
end
|
22
34
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
35
|
+
rescue
|
36
|
+
warn "Line coverage disabled: #{$!}"
|
37
|
+
@trace = nil
|
27
38
|
end
|
28
|
-
rescue
|
29
|
-
warn "Line coverage disabled: #{$!}"
|
30
|
-
@trace = nil
|
31
39
|
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def enable
|
35
|
-
super
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
def enable
|
42
|
+
super
|
43
|
+
|
44
|
+
@trace&.enable
|
45
|
+
end
|
46
|
+
|
47
|
+
def disable
|
48
|
+
@trace&.disable
|
49
|
+
|
50
|
+
super
|
51
|
+
end
|
42
52
|
|
43
|
-
|
53
|
+
def execute(source, binding: TOPLEVEL_BINDING)
|
54
|
+
enable
|
55
|
+
|
56
|
+
eval(source.code!, binding, source.path)
|
57
|
+
ensure
|
58
|
+
disable
|
59
|
+
end
|
44
60
|
end
|
45
|
-
|
46
|
-
|
47
|
-
enable
|
61
|
+
else
|
62
|
+
class Capture < Wrapper
|
63
|
+
def enable
|
64
|
+
super
|
65
|
+
|
66
|
+
::Coverage.start(lines: true, eval: true)
|
67
|
+
end
|
48
68
|
|
49
|
-
|
50
|
-
|
51
|
-
|
69
|
+
def disable
|
70
|
+
results = ::Coverage.result
|
71
|
+
|
72
|
+
results.each do |path, result|
|
73
|
+
lines = result[:lines]
|
74
|
+
|
75
|
+
lines.each_with_index do |count, lineno|
|
76
|
+
@output.mark(path, lineno+1, count) if count
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
super
|
81
|
+
end
|
82
|
+
|
83
|
+
def execute(source, binding: TOPLEVEL_BINDING)
|
84
|
+
enable
|
85
|
+
|
86
|
+
eval(source.code!, binding, source.path)
|
87
|
+
ensure
|
88
|
+
disable
|
89
|
+
end
|
52
90
|
end
|
53
91
|
end
|
54
|
-
|
55
|
-
# class Capture < Wrapper
|
56
|
-
# def enable
|
57
|
-
# super
|
58
|
-
#
|
59
|
-
# ::Coverage.start
|
60
|
-
# end
|
61
|
-
#
|
62
|
-
# def disable
|
63
|
-
# result = ::Coverage.result
|
64
|
-
#
|
65
|
-
# puts result.inspect
|
66
|
-
#
|
67
|
-
# result.each do |path, lines|
|
68
|
-
# lines.each_with_index do |lineno, count|
|
69
|
-
# @output.mark(path, lineno, count)
|
70
|
-
# end
|
71
|
-
# end
|
72
|
-
#
|
73
|
-
# super
|
74
|
-
# end
|
75
|
-
# end
|
76
92
|
end
|
data/lib/covered/persist.rb
CHANGED
@@ -8,7 +8,6 @@ require_relative 'wrapper'
|
|
8
8
|
require 'msgpack'
|
9
9
|
require 'time'
|
10
10
|
require 'set'
|
11
|
-
require 'console'
|
12
11
|
|
13
12
|
module Covered
|
14
13
|
class Persist < Wrapper
|
@@ -26,7 +25,7 @@ module Covered
|
|
26
25
|
return unless path = expand_path(record[:path])
|
27
26
|
|
28
27
|
unless File.exist?(path)
|
29
|
-
|
28
|
+
# Ignore this coverage, the file no longer exists.
|
30
29
|
return
|
31
30
|
end
|
32
31
|
|
@@ -35,7 +34,7 @@ module Covered
|
|
35
34
|
|
36
35
|
unless ignore_mtime
|
37
36
|
if File.mtime(path).to_f > record[:mtime]
|
38
|
-
|
37
|
+
# Ignore this coverage, the file has been modified since it was recorded.
|
39
38
|
return
|
40
39
|
end
|
41
40
|
end
|
@@ -66,8 +65,6 @@ module Covered
|
|
66
65
|
File.open(@path, "rb") do |file|
|
67
66
|
file.flock(File::LOCK_SH)
|
68
67
|
|
69
|
-
Console.logger.debug(self) {"Loading from #{@path} with #{options}..."}
|
70
|
-
|
71
68
|
make_unpacker(file).each do |record|
|
72
69
|
self.apply(record, **options)
|
73
70
|
end
|
@@ -79,8 +76,6 @@ module Covered
|
|
79
76
|
File.open(@path, "wb") do |file|
|
80
77
|
file.flock(File::LOCK_EX)
|
81
78
|
|
82
|
-
Console.logger.debug(self) {"Saving to #{@path}..."}
|
83
|
-
|
84
79
|
packer = make_packer(file)
|
85
80
|
|
86
81
|
self.each do |coverage|
|
data/lib/covered/rspec.rb
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
# Copyright, 2018-2022, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'config'
|
7
|
-
|
8
7
|
require 'rspec/core/formatters'
|
9
8
|
|
10
9
|
$covered = Covered::Config.load
|
@@ -13,6 +12,7 @@ module Covered
|
|
13
12
|
module RSpec
|
14
13
|
module Policy
|
15
14
|
def load_spec_files
|
15
|
+
$stderr.puts "load_spec_files"
|
16
16
|
$covered.enable
|
17
17
|
|
18
18
|
super
|
data/lib/covered/summary.rb
CHANGED
@@ -6,8 +6,6 @@
|
|
6
6
|
require_relative 'statistics'
|
7
7
|
require_relative 'wrapper'
|
8
8
|
|
9
|
-
require 'console/terminal'
|
10
|
-
|
11
9
|
module Covered
|
12
10
|
class Summary
|
13
11
|
def initialize(threshold: 1.0)
|
@@ -15,6 +13,8 @@ module Covered
|
|
15
13
|
end
|
16
14
|
|
17
15
|
def terminal(output)
|
16
|
+
require 'console/terminal'
|
17
|
+
|
18
18
|
Console::Terminal.for(output).tap do |terminal|
|
19
19
|
terminal[:path] ||= terminal.style(nil, nil, :bold, :underline)
|
20
20
|
terminal[:brief_path] ||= terminal.style(:yellow)
|
data/lib/covered/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
42
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
43
43
|
-----END CERTIFICATE-----
|
44
|
-
date: 2022-
|
44
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: async-rest
|
metadata.gz.sig
CHANGED
Binary file
|