coverband 6.1.3 → 6.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/changes.md +5 -0
- data/lib/coverband/collectors/view_tracker.rb +4 -1
- data/lib/coverband/configuration.rb +1 -1
- data/lib/coverband/version.rb +1 -1
- data/lib/coverband.rb +1 -1
- data/test/coverband/collectors/view_tracker_test.rb +4 -4
- data/test/coverband/configuration_test.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3ffdf0c9a4cefbcbc728967f36ed20a90755074864a2fe858859b739e6912bb
|
4
|
+
data.tar.gz: e853e687820d45bbf414f51efd3a51f996b05f5eff0dcecac95351b076b3300d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f2f69c9de574808771f002af9fc4903fed8ec9af0d52288457759ff21b1c8a3c0e42111a6ea59c8830893fc57acf05e300f8520903dda920a894419710ad386
|
7
|
+
data.tar.gz: 20073041f076062cefeeeb8bcec74d703086d70c86c6f7b0b2511474f5c0cd2b9cb61510245cca49104dff53a8979249a2b4dae2bfad85b09682c9dd56ce5628
|
data/README.md
CHANGED
@@ -307,6 +307,11 @@ Now that Coverband uses MD5 hashes there should be no reason to manually clear c
|
|
307
307
|
|
308
308
|
This can also be done through the web if `config.web_enable_clear` is enabled.
|
309
309
|
|
310
|
+
**NOTE**: The previous task does not clear the trackers data (views, routes, translations, etc).
|
311
|
+
To clear trackers data, run
|
312
|
+
|
313
|
+
`rake coverband:clear_tracker`
|
314
|
+
|
310
315
|
### Adding Rake Tasks outside of Rails
|
311
316
|
|
312
317
|
Rails apps should automatically include the tasks via the Railtie.
|
data/changes.md
CHANGED
@@ -17,6 +17,7 @@ module Coverband
|
|
17
17
|
|
18
18
|
REPORT_ROUTE = "views_tracker"
|
19
19
|
TITLE = "Views"
|
20
|
+
VIEWS_PATTERNS = %w[.erb$ .haml$ .slim$]
|
20
21
|
|
21
22
|
def initialize(options = {})
|
22
23
|
@project_directory = File.expand_path(Coverband.configuration.root)
|
@@ -24,6 +25,8 @@ module Coverband
|
|
24
25
|
@roots = @roots.split(",") if @roots.is_a?(String)
|
25
26
|
|
26
27
|
super
|
28
|
+
|
29
|
+
@ignore_patterns -= VIEWS_PATTERNS.map { |ignore_str| Regexp.new(ignore_str) }
|
27
30
|
end
|
28
31
|
|
29
32
|
def railtie!
|
@@ -84,7 +87,7 @@ module Coverband
|
|
84
87
|
recently_used_views = used_keys.keys
|
85
88
|
unused_views = all_keys - recently_used_views
|
86
89
|
# since layouts don't include format we count them used if they match with ANY formats
|
87
|
-
unused_views.reject { |view| view.include?("/layouts/") && recently_used_views.any? { |used_view| view.include?(used_view) } }
|
90
|
+
unused_views = unused_views.reject { |view| view.include?("/layouts/") && recently_used_views.any? { |used_view| view.include?(used_view) } }
|
88
91
|
unused_views.reject { |view| @ignore_patterns.any? { |pattern| view.match?(pattern) } }
|
89
92
|
end
|
90
93
|
|
@@ -48,7 +48,7 @@ module Coverband
|
|
48
48
|
# Heroku when building assets runs code from a dynamic directory
|
49
49
|
# /tmp was added to avoid coverage from /tmp/build directories during
|
50
50
|
# heroku asset compilation
|
51
|
-
IGNORE_DEFAULTS = %w[vendor/
|
51
|
+
IGNORE_DEFAULTS = %w[vendor/ /tmp internal:prelude db/schema.rb] + Collectors::ViewTracker::VIEWS_PATTERNS
|
52
52
|
|
53
53
|
# Add in missing files which were never loaded
|
54
54
|
# we need to know what all paths to check for unloaded files
|
data/lib/coverband/version.rb
CHANGED
data/lib/coverband.rb
CHANGED
@@ -5,7 +5,6 @@ require "json"
|
|
5
5
|
require "redis"
|
6
6
|
require "coverband/version"
|
7
7
|
require "coverband/at_exit"
|
8
|
-
require "coverband/configuration"
|
9
8
|
require "coverband/utils/relative_file_converter"
|
10
9
|
require "coverband/utils/absolute_file_converter"
|
11
10
|
require "coverband/adapters/base"
|
@@ -27,6 +26,7 @@ require "coverband/reporters/console_report"
|
|
27
26
|
require "coverband/integrations/background"
|
28
27
|
require "coverband/integrations/background_middleware"
|
29
28
|
require "coverband/integrations/rack_server_check"
|
29
|
+
require "coverband/configuration"
|
30
30
|
|
31
31
|
Coverband::Adapters::RedisStore = Coverband::Adapters::HashRedisStore if ENV["COVERBAND_HASH_REDIS_STORE"]
|
32
32
|
|
@@ -88,22 +88,22 @@ class ViewTrackerTest < Minitest::Test
|
|
88
88
|
Coverband::Collectors::ViewTracker.expects(:supported_version?).returns(true)
|
89
89
|
store = fake_store
|
90
90
|
file_path = "#{File.expand_path(Coverband.configuration.root)}/file"
|
91
|
-
target = [file_path, "not_used"]
|
91
|
+
target = [file_path, "not_used.html.erb"]
|
92
92
|
tracker = Coverband::Collectors::ViewTracker.new(store: store, roots: "dir", target: target)
|
93
93
|
tracker.track_key(identifier: file_path)
|
94
94
|
tracker.save_report
|
95
|
-
assert_equal ["not_used"], tracker.unused_keys
|
95
|
+
assert_equal ["not_used.html.erb"], tracker.unused_keys
|
96
96
|
end
|
97
97
|
|
98
98
|
test "report hides partials marked in ignore config" do
|
99
99
|
Coverband::Collectors::ViewTracker.expects(:supported_version?).returns(true)
|
100
100
|
store = fake_store
|
101
101
|
file_path = "#{File.expand_path(Coverband.configuration.root)}/app/views/anything/ignore_me.html.erb"
|
102
|
-
target = [file_path, "not_used"]
|
102
|
+
target = [file_path, "not_used.html.erb"]
|
103
103
|
tracker = Coverband::Collectors::ViewTracker.new(store: store, roots: "dir", target: target)
|
104
104
|
tracker.track_key(identifier: file_path)
|
105
105
|
tracker.save_report
|
106
|
-
assert_equal ["not_used"], tracker.unused_keys
|
106
|
+
assert_equal ["not_used.html.erb"], tracker.unused_keys
|
107
107
|
assert_equal [], tracker.used_keys.keys
|
108
108
|
end
|
109
109
|
|
@@ -18,7 +18,7 @@ class BaseTest < Minitest::Test
|
|
18
18
|
|
19
19
|
test "ignore works with equal" do
|
20
20
|
Coverband::Collectors::Coverage.instance.reset_instance
|
21
|
-
expected = ["vendor/", "
|
21
|
+
expected = ["vendor/", "/tmp", "internal:prelude", "db/schema.rb", ".erb$", ".haml$", ".slim$", "config/environments"].map { |str| Regexp.new(str) }
|
22
22
|
assert_equal expected, Coverband.configuration.ignore
|
23
23
|
end
|
24
24
|
|
@@ -28,11 +28,12 @@ class BaseTest < Minitest::Test
|
|
28
28
|
end
|
29
29
|
Coverband::Collectors::Coverage.instance.reset_instance
|
30
30
|
expected = ["vendor/",
|
31
|
-
".erb$",
|
32
|
-
".slim$",
|
33
31
|
"/tmp",
|
34
32
|
"internal:prelude",
|
35
33
|
"db/schema.rb",
|
34
|
+
".erb$",
|
35
|
+
".haml$",
|
36
|
+
".slim$",
|
36
37
|
"config/environments",
|
37
38
|
"config/initializers"].map { |str| Regexp.new(str) }
|
38
39
|
assert_equal expected, Coverband.configuration.ignore
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coverband
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-10-
|
12
|
+
date: 2024-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: benchmark-ips
|