Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/covered/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def policy_for(paths = nil, ignore_mtime: true)
# Which paths to ignore when computing coverage for a given project.
# @returns [Array(String)] An array of relative paths to ignore.
def ignore_paths
["test/", "fixtures/", "spec/", "vendor/", "config/"]
["test/", "fixtures/", "spec/", "integration/", "vendor/", "config/"]
end

# Which paths to include when computing coverage for a given project.
Expand Down
4 changes: 4 additions & 0 deletions releases.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Releases

## Unreleased

- Ignore files under `integration/` when evaluating coverage.

## v0.29.0

- Prefer `ruby-coverage` over `coverage` for improved coverage tracking.
Expand Down
24 changes: 24 additions & 0 deletions test/covered/persist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@
describe Covered::Config do
include Sus::Fixtures::TemporaryDirectoryContext

it "ignores integration test paths by default" do
FileUtils.mkdir_p(File.join(root, "integration"))
FileUtils.mkdir_p(File.join(root, "lib"))

integration_path = File.join(root, "integration", "example.rb")
lib_path = File.join(root, "lib", "example.rb")

File.write(integration_path, "puts :integration\n")
File.write(lib_path, "puts :lib\n")

output = Covered::Files.new
output.add(Covered::Coverage.new(Covered::Source.new(integration_path), [nil, 1]))
output.add(Covered::Coverage.new(Covered::Source.new(lib_path), [nil, 1]))

database_path = File.join(root, Covered::Persist::DEFAULT_PATH)
Covered::Persist.new(output, database_path).save!

config = subject.load(root: root, reports: false)
policy = config.policy_for(database_path)

expect(policy.to_h).to have_keys(lib_path)
expect(policy.to_h).not.to have_keys(integration_path)
end

it "loads persisted coverage using the configured policy" do
FileUtils.mkdir_p(File.join(root, "config"))
FileUtils.mkdir_p(File.join(root, "examples"))
Expand Down
Loading