coverband 4.2.1.rc2 → 4.2.1.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b36c74e7000d8cd20c424fff66e2de35be821c440fbaf54be18b81e2e8de48d1
4
- data.tar.gz: b459fd5abde8bdb4cb5283e9512ccc8a25e61d98fd6bb678d16854273f8df1a0
3
+ metadata.gz: 5cb0c3fd4256ad4d254c22cd98528bc34528e968ca65cfebc3a4720844e2a07d
4
+ data.tar.gz: 83cb0d9d97861c92e688274dc6885025ff2282d6a2625e473b148a3f68be0c05
5
5
  SHA512:
6
- metadata.gz: 0e906b9c7e280e18b10e5c852199fb379600642c50bb566d678ea17ca2633ced35fc5d184ac93665c5c7eecc80ca0ee49cac161ff0dda06f66cc81b626031722
7
- data.tar.gz: f59cb2a359a719837577ba143c60f6ad1e16fe12272c34843d8a0b9c030ab4030afc32343e3d3bbad6804f1f326e47f81cddc7c84e913a14f173c2bb9652c507
6
+ metadata.gz: 2d1206b71ffe2fddb8145a5f168a317a5e54373dd2b8b708ae6c86da800d015215c7d60b9906c791b725c8127add8bfb59343cad812f4f70ddc69b00d7a179a3
7
+ data.tar.gz: d2c1e07f8df62c8b4c4be64f009e2206b103b1685e2064664b1042d6ae25c9196247832007e707b6b3a7e1aa67aed454857bc64f13d44d594d86878f903d1a02
@@ -13,8 +13,6 @@ script:
13
13
  - bundle exec rake rubocop
14
14
  - bundle exec rake
15
15
  - bundle exec rake forked_tests
16
- addons:
17
- chrome: stable
18
16
  before_install:
19
17
  - echo 'this is a hack to clear default bundler and force bundler 1.17.3'
20
18
  - ls /home/travis/.rvm/gems/
@@ -24,4 +22,3 @@ before_install:
24
22
  - gem uninstall bundler || true
25
23
  - gem install bundler -v '1.17.3'
26
24
  - bundler --version
27
- - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
data/README.md CHANGED
@@ -254,6 +254,8 @@ By adding any files above you will get reporting on those files as part of your
254
254
 
255
255
  ### Collecting Gem / Library Usage
256
256
 
257
+ __NOTE:__ Gem Tracking is still in testing stagings we have some performance issues on the reporting side and have heard reports of increased memory usage. We recommend deploying WITHOUT `track_gems` first and only enabling it after confirming that Coverband is working and performing well.
258
+
257
259
  Gem usage can be tracked by enabling the `track_gems` config.
258
260
 
259
261
  ```
data/changes.md CHANGED
@@ -49,6 +49,7 @@ Will be the fully modern release that drops maintenance legacy support in favor
49
49
  - move all code to work with relative paths leaving only stdlib Coverage working on full paths
50
50
  - add gem_safe_lists to track only some gems
51
51
  - add gem_details_safe list to report on details on some gems
52
+ - - display gems that are in loaded with 0 coverage, thanks @kbaum
52
53
 
53
54
  ### Coverband_jam_session
54
55
 
@@ -91,7 +92,7 @@ Feature Ideas:
91
92
  - improved runtime / eager loading tracking
92
93
  - updated runtime relavent lines and runtime percentages
93
94
  - fix on gem runtime code coverage support, thanks @kbaum
94
- - display gems that are in loaded with 0 coverage, thanks @kbaum
95
+
95
96
 
96
97
  # Released
97
98
 
@@ -35,8 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'rake'
36
36
  spec.add_development_dependency 'resque'
37
37
  spec.add_development_dependency 'rubocop'
38
- spec.add_development_dependency 'selenium-webdriver'
39
- spec.add_development_dependency 'webdrivers', '~> 3.0'
40
38
  # temporarily needed to run tests for classifier-reborn as part of benchmarks
41
39
  spec.add_development_dependency 'minitest-reporters'
42
40
 
@@ -27,16 +27,12 @@ module Coverband
27
27
  ###
28
28
  def fix_reports(reports)
29
29
  # list all files, even if not tracked by Coverband (0% coverage)
30
- file_patterns = ["#{Coverband.configuration.current_root}/{app,lib,config}/**/*.{rb}"]
31
- if Coverband.configuration.track_gems
32
- file_patterns.concat(Bundler.definition.specs.reject { |spec| spec.name == 'coverband' }.map(&:full_require_paths)
33
- .flatten.map { |path| "#{path}/**/*.{rb}" })
34
- end
30
+ tracked_glob = "#{Coverband.configuration.current_root}/{app,lib,config}/**/*.{rb}"
35
31
  filtered_report_files = {}
36
32
 
37
33
  reports.each_pair do |report_name, report_data|
38
34
  filtered_report_files[report_name] = {}
39
- report_files = Coverband::Utils::Result.add_not_loaded_files(report_data, file_patterns)
35
+ report_files = Coverband::Utils::Result.add_not_loaded_files(report_data, tracked_glob)
40
36
 
41
37
  # apply coverband filters
42
38
  report_files.each_pair do |file, data|
@@ -53,14 +53,17 @@ module Coverband
53
53
 
54
54
  # Finds files that were to be tracked but were not loaded and initializes
55
55
  # the line-by-line coverage to zero (if relevant) or nil (comments / whitespace etc).
56
- def self.add_not_loaded_files(result, file_patterns)
57
- file_patterns.each_with_object(result.dup) do |file_pattern, results_dup|
58
- Dir[file_pattern].each do |file|
56
+ def self.add_not_loaded_files(result, tracked_files)
57
+ if tracked_files
58
+ result = result.dup
59
+ Dir[tracked_files].each do |file|
59
60
  absolute = File.expand_path(file)
60
61
 
61
- results_dup[absolute] ||= Coverband::Utils::LinesClassifier.new.classify(File.foreach(absolute))
62
+ result[absolute] ||= Coverband::Utils::LinesClassifier.new.classify(File.foreach(absolute))
62
63
  end
63
64
  end
65
+
66
+ result
64
67
  end
65
68
  end
66
69
  end
@@ -253,7 +253,7 @@ module Coverband
253
253
  end
254
254
 
255
255
  def gem_name
256
- gem? ? short_name.split('/').first.gsub(/^\./, '') : nil
256
+ gem? ? short_name.split('/').first.gsub(%r{^\.}, '') : nil
257
257
  end
258
258
 
259
259
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coverband
4
- VERSION = '4.2.1.rc2'
4
+ VERSION = '4.2.1.rc3'
5
5
  end
@@ -32,7 +32,10 @@ namespace :benchmarks do
32
32
  end
33
33
 
34
34
  def clone_classifier
35
- system "git clone https://github.com/jekyll/classifier-reborn.git #{classifier_dir}" unless Dir.exist? classifier_dir
35
+ unless Dir.exist? classifier_dir
36
+ system "git clone https://github.com/jekyll/classifier-reborn.git #{classifier_dir}"
37
+ end
38
+ # rubocop:enable Style/IfUnlessModifier
36
39
  end
37
40
 
38
41
  # desc 'setup standard benchmark'
@@ -11,7 +11,7 @@ class ReportHTMLTest < Minitest::Test
11
11
  Coverband.configure do |config|
12
12
  config.store = @store
13
13
  config.root = fixtures_root
14
- config.ignore = ['notsomething.rb']
14
+ config.ignore = ['notsomething.rb', 'lib/*']
15
15
  end
16
16
  mock_file_hash
17
17
  end
@@ -36,30 +36,6 @@ class ReportHTMLTest < Minitest::Test
36
36
  assert_match 'app/models/user.rb', html
37
37
  end
38
38
 
39
- test 'Gem files with no coverage are shown in report' do
40
- Coverband.configure do |config|
41
- config.track_gems = true
42
- end
43
- @store.send(:save_report, basic_source_fixture_coverage)
44
-
45
- html = Coverband::Reporters::HTMLReport.new(@store,
46
- static: false,
47
- open_report: false).report
48
- assert_match 'rainbow', html
49
- end
50
-
51
- test 'Gem files are not shown in report when not configured' do
52
- Coverband.configure do |config|
53
- config.track_gems = false
54
- end
55
- @store.send(:save_report, basic_source_fixture_coverage)
56
-
57
- html = Coverband::Reporters::HTMLReport.new(@store,
58
- static: false,
59
- open_report: false).report
60
- refute_match 'rainbow', html
61
- end
62
-
63
39
  test 'generate static HTML report file' do
64
40
  @store.send(:save_report, basic_coverage)
65
41
 
@@ -76,9 +52,9 @@ class ReportHTMLTest < Minitest::Test
76
52
  filename = basic_coverage_file_full_path
77
53
  base_path = '/coverage'
78
54
  html = Coverband::Reporters::HTMLReport.new(Coverband.configuration.store,
79
- filename: filename,
80
- base_path: base_path,
81
- open_report: false).file_details
55
+ filename: filename,
56
+ base_path: base_path,
57
+ open_report: false).file_details
82
58
  assert_match 'Coverage first seen', html
83
59
  end
84
60
 
@@ -88,9 +64,9 @@ class ReportHTMLTest < Minitest::Test
88
64
  filename = 'missing_path'
89
65
  base_path = '/coverage'
90
66
  html = Coverband::Reporters::HTMLReport.new(Coverband.configuration.store,
91
- filename: filename,
92
- base_path: base_path,
93
- open_report: false).file_details
67
+ filename: filename,
68
+ base_path: base_path,
69
+ open_report: false).file_details
94
70
  assert_match 'File No Longer Available', html
95
71
  end
96
72
 
@@ -100,9 +76,9 @@ class ReportHTMLTest < Minitest::Test
100
76
  filename = "#{test_root}/test_helper.rb"
101
77
  base_path = '/coverage'
102
78
  html = Coverband::Reporters::HTMLReport.new(Coverband.configuration.store,
103
- filename: filename,
104
- base_path: base_path,
105
- open_report: false).file_details
79
+ filename: filename,
80
+ base_path: base_path,
81
+ open_report: false).file_details
106
82
  assert_match 'File No Longer Available', html
107
83
  end
108
84
  end
@@ -16,27 +16,6 @@ describe 'result' do
16
16
  }
17
17
  end
18
18
 
19
- describe '#add_not_loaded_files' do
20
- it 'Adds files not yet tracked' do
21
- results = Coverband::Utils::Result.add_not_loaded_files({}, ['./test/dog.*'])
22
- dog_file = results.keys.grep(/dog.rb/).first
23
- assert dog_file
24
- end
25
-
26
- it 'Does not overrwrite existing coverage' do
27
- dog_file = File.expand_path('./test/dog.rb')
28
- results = Coverband::Utils::Result.add_not_loaded_files({ dog_file => [0, 1] }, ['./test/dog.*'])
29
- assert_equal({ dog_file => [0, 1] }, results)
30
- end
31
-
32
- it 'Adds files not yet tracked from multiple file globs' do
33
- dog_file = File.expand_path('./test/dog.rb')
34
- test_helper_file = File.expand_path('./test/test_helper.rb')
35
- results = Coverband::Utils::Result.add_not_loaded_files({}, ['./test/dog.*', './test/test_helper.rb'])
36
- assert_equal [dog_file, test_helper_file].to_set, results.keys.to_set
37
- end
38
- end
39
-
40
19
  describe 'a simple cov result initialized from that' do
41
20
  subject { Coverband::Utils::Result.new(original_result) }
42
21
 
@@ -11,6 +11,8 @@ class RailsFullStackTest < Minitest::Test
11
11
  rails_setup
12
12
  # preload first coverage hit
13
13
  Coverband.report_coverage
14
+ require 'rainbow'
15
+ Rainbow('this text is red').red
14
16
  end
15
17
 
16
18
  def teardown
@@ -19,17 +21,10 @@ class RailsFullStackTest < Minitest::Test
19
21
  Capybara.use_default_driver
20
22
  end
21
23
 
22
- test 'list all gems even if no coverage' do
23
- Capybara.current_driver = :selenium_chrome_headless
24
- visit '/coverage'
25
- find('a.Gems').click
26
- assert_selector('a.gem-link', text: /pundit/)
27
- assert_selector('a.gem-link', text: /rainbow/)
28
- end
29
-
24
+ # We have to combine everything in one test
25
+ # because we can only initialize rails once per test
26
+ # run. Possibly fork test runs to avoid this problem in future?
30
27
  test 'this is how we do it' do
31
- require 'rainbow'
32
- Rainbow('this text is red').red
33
28
  visit '/dummy/show'
34
29
  Coverband.report_coverage
35
30
  assert_content('I am no dummy')
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'selenium-webdriver'
4
- require 'webdrivers'
5
3
  require 'minitest'
6
4
  require 'minitest/fork_executor'
7
5
 
@@ -31,5 +29,4 @@ def rails_setup
31
29
  # Our coverage report is wrapped in display:none as of now
32
30
  Capybara.ignore_hidden_elements = false
33
31
  require 'mocha/minitest'
34
- Capybara.server = :webrick
35
32
  end
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: 4.2.1.rc2
4
+ version: 4.2.1.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -193,34 +193,6 @@ dependencies:
193
193
  - - ">="
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
- - !ruby/object:Gem::Dependency
197
- name: selenium-webdriver
198
- requirement: !ruby/object:Gem::Requirement
199
- requirements:
200
- - - ">="
201
- - !ruby/object:Gem::Version
202
- version: '0'
203
- type: :development
204
- prerelease: false
205
- version_requirements: !ruby/object:Gem::Requirement
206
- requirements:
207
- - - ">="
208
- - !ruby/object:Gem::Version
209
- version: '0'
210
- - !ruby/object:Gem::Dependency
211
- name: webdrivers
212
- requirement: !ruby/object:Gem::Requirement
213
- requirements:
214
- - - "~>"
215
- - !ruby/object:Gem::Version
216
- version: '3.0'
217
- type: :development
218
- prerelease: false
219
- version_requirements: !ruby/object:Gem::Requirement
220
- requirements:
221
- - - "~>"
222
- - !ruby/object:Gem::Version
223
- version: '3.0'
224
196
  - !ruby/object:Gem::Dependency
225
197
  name: minitest-reporters
226
198
  requirement: !ruby/object:Gem::Requirement