rspec-circleci-coverage 0.1.1105 → 0.1.1110
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
- data/lib/rspec/circleci/coverage.rb +7 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da373f1ca732617969ed0c296eb75d4088264b62b3e110cbe06ffb7ba0846c57
|
|
4
|
+
data.tar.gz: 207dc74865df6bb8dc064ed0f87cf89fa95ee27fe25626906f56d9e994b7ed2e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77154cb1574396b5729c7c059406edb38f258cf196566adbfd5f7cc519335af69adbd363d553b7a16364ea00006384d652c62600b74ffa6e695b91325b07e7bb
|
|
7
|
+
data.tar.gz: f4ebcaabfdaac8978a19c6e5bf03254279cae3784441421555c38be4235ef1c386636438b48a9ca4b1718f10bf6a95eb9cb4ef70a8fbb0800223001e8c7b5b65
|
|
@@ -67,16 +67,20 @@ module RSpec
|
|
|
67
67
|
|
|
68
68
|
# Calculate which lines were executed during this test
|
|
69
69
|
test_key = format_test_key(example)
|
|
70
|
+
# Read Dir.pwd (a system call) once per diff, not once per file
|
|
71
|
+
project_root = Dir.pwd
|
|
70
72
|
|
|
71
73
|
after_coverage.each do |file, coverage|
|
|
72
74
|
# Skip files outside project scope, spec files, and rspec gem internals
|
|
73
|
-
next unless in_project_scope?(file)
|
|
75
|
+
next unless in_project_scope?(file, project_root)
|
|
74
76
|
next if file.end_with?('_spec.rb')
|
|
75
77
|
|
|
76
78
|
lines = extract_lines(coverage)
|
|
77
79
|
next if lines.nil?
|
|
78
80
|
|
|
79
81
|
before_lines = extract_lines(@before_coverage[file])
|
|
82
|
+
# Skip unchanged files; Array#== runs in C, much faster than the loop below
|
|
83
|
+
next if lines == before_lines
|
|
80
84
|
|
|
81
85
|
# Any line whose count increased means this test executed the file.
|
|
82
86
|
executed = lines.each_with_index.any? do |count, index|
|
|
@@ -120,10 +124,10 @@ module RSpec
|
|
|
120
124
|
pathname.absolute? ? pathname.relative_path_from(Dir.pwd).to_s : file
|
|
121
125
|
end
|
|
122
126
|
|
|
123
|
-
def in_project_scope?(file)
|
|
127
|
+
def in_project_scope?(file, project_root = Dir.pwd)
|
|
124
128
|
# Check if file is within the project directory
|
|
125
129
|
# Files outside the project (system files, gems, etc.) should be filtered out
|
|
126
|
-
return false unless file.start_with?(
|
|
130
|
+
return false unless file.start_with?(project_root)
|
|
127
131
|
|
|
128
132
|
# Exclude gem files (even if they're in .bundle or vendor directories)
|
|
129
133
|
return false if file.include?('/gems/')
|