Skip to content

Commit 8e87a70

Browse files
committed
fixup! WIP: Setup code coverage for storefront
1 parent 82f385b commit 8e87a70

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

storefront/lib/testing_support/coverage.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@
1212
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
1313
end
1414

15+
def (SimpleCov::ResultAdapter).call(result)
16+
result = result.transform_keys do |path|
17+
template_path = path.sub(
18+
"#{SimpleCov.root}/",
19+
"#{SimpleCov.root}/../storefront/templates/"
20+
)
21+
File.exist?(template_path) ? template_path : path
22+
end
23+
result.each do |path, coverage|
24+
next unless path.end_with?(".erb")
25+
26+
# Remove the extra trailing lines added by ERB
27+
coverage[:lines] = coverage[:lines][...File.read(path).lines.size]
28+
end
29+
result
30+
end
31+
1532
SimpleCov.command_name("solidus:storefront")
1633
SimpleCov.merge_timeout(3600)
1734
SimpleCov.start("rails")

0 commit comments

Comments
 (0)