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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f2a5ea961e3ea2ad0df6f27a6de26dabf618f1c98dfd62dbb3e4db4b68e5ef7
4
- data.tar.gz: 5a6badc41b5bec9f0859a88c2c98678f84f75bafb2c914e69999b4854fa7efac
3
+ metadata.gz: da373f1ca732617969ed0c296eb75d4088264b62b3e110cbe06ffb7ba0846c57
4
+ data.tar.gz: 207dc74865df6bb8dc064ed0f87cf89fa95ee27fe25626906f56d9e994b7ed2e
5
5
  SHA512:
6
- metadata.gz: 2acc6e4b6d680c7c838a64cfe3a455a0c81dfbda1a0c033dceb5432b80b7ec37f967fb17163554aca8ce7721318ac38e7ff37d7c9eadc3f94a517ff17f0c8d50
7
- data.tar.gz: 417c88fe588cc4773fe6d3764c9cda7390f69da08807e7506466eabb19be98da85504329d4fd2ab5755dd7839b878d9080c60b4bbef8ece56d1bc6498cdf3dc2
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?(Dir.pwd)
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/')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-circleci-coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1105
4
+ version: 0.1.1110
5
5
  platform: ruby
6
6
  authors:
7
7
  - CircleCI