simplecov 0.19.1 → 0.20.0

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: 22a798d9e27a53d890729a39af723d247639cfa54895411b88ec43979bf89dfc
4
- data.tar.gz: dabcb66862e3d4c9b8d1236b52539cd4279ecad22fe2af26fca52efeeb50f6e9
3
+ metadata.gz: d2eb0d25fab09baa70be8ae06fccdb2012a8df84a2969c065b7e992bc5c52dd1
4
+ data.tar.gz: f18aa7a169ac514bd9a9f52e887e70df46f57ff9c9501835edaa5a01c8908af0
5
5
  SHA512:
6
- metadata.gz: f7f8f019161301a0c727291f6df9cf4e6c7d16212184439f412e8c6e46936037ade769fedba30c8d6ac211383aed291aaa2379445d8ce9b26cc41654b4e16ab6
7
- data.tar.gz: ea1796d3b02b0fc02c7222457a2a05746e9781e70c4dc37eab2645f3e7028216f1a6383d05a43b33519db95771be169889569bd25448b814e833864bdbaaaad9
6
+ metadata.gz: 629025908d4b7e17016b11ea183c8ef0138d67c774b50d95c293f1164e4e97bccbb87ae3c4c0d18b4ff2460c7b8ebf897847471a14be10d89d30c77d3269a8de
7
+ data.tar.gz: 4e2d2cfdf1d4f392a1a50d03389698cad05bbf27de48dabdf895803e2aab5f3d515a64155a1c118a77fb9f138f3f2e0c9ad14e3d5b496b79bc57ecfe38fc67a5
@@ -1,3 +1,13 @@
1
+ 0.20.0 (2020-11-29)
2
+ ==========
3
+
4
+ The "JSON formatter" release. Starting now a JSON formatter is included by default in the release. This is mostly done for Code Climate reasons, you can find more details [in this issue](https://github.com/codeclimate/test-reporter/issues/413).
5
+ Shipping with so much by default is sub-optimal, we know. It's the long term plan to also provide `simplecov-core` without the HTML or JSON formatters for those who don't need them/for other formatters to rely on.
6
+
7
+ ## Enhancements
8
+ * `simplecov_json_formatter` included by default ([docs](https://github.com/simplecov-ruby/simplecov#json-formatter)), this should enable the Code Climate test reporter to work again once it's updated
9
+ * invalidate internal cache after switching `SimpleCov.root`, should help with some bugs
10
+
1
11
  0.19.1 (2020-10-25)
2
12
  ==========
3
13
 
data/README.md CHANGED
@@ -73,9 +73,10 @@ Getting started
73
73
  analysis to happen on. When testing a server process (e.g. a JSON API
74
74
  endpoint) via a separate test process (e.g. when using Selenium) where you
75
75
  want to see all code executed by the `rails server`, and not just code
76
- executed in your actual test files, you'll want to add something like this
76
+ executed in your actual test files, you need to require SimpleCov in the
77
+ server process. For rails for instance, you'll want to add something like this
77
78
  to the top of `bin/rails`, but below the "shebang" line (`#! /usr/bin/env
78
- ruby`):
79
+ ruby`) and after config/boot is required:
79
80
 
80
81
  ```ruby
81
82
  if ENV['RAILS_ENV'] == 'test'
@@ -833,6 +834,20 @@ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
833
834
  ])
834
835
  ```
835
836
 
837
+ ## JSON formatter
838
+
839
+ SimpleCov is packaged with a separate gem called [simplecov_json_formatter](https://github.com/codeclimate-community/simplecov_json_formatter) that provides you with a JSON formatter, this formatter could be useful for different use cases, such as for CI consumption or for reporting to external services.
840
+
841
+ In order to use it you will need to manually load the installed gem like so:
842
+
843
+ ```ruby
844
+ require "simplecov_json_formatter"
845
+ SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
846
+ ```
847
+
848
+ > _Note:_ In case you plan to report your coverage results to CodeClimate services, know that SimpleCov will automatically use the
849
+ > JSON formatter along with the HTML formatter when the `CC_TEST_REPORTER_ID` variable is present in the environment.
850
+
836
851
  ## Available formatters, editor integrations and hosted services
837
852
 
838
853
  * [Open Source formatter and integration plugins for SimpleCov](doc/alternate-formatters.md)
@@ -22,6 +22,7 @@ module SimpleCov
22
22
  def root(root = nil)
23
23
  return @root if defined?(@root) && root.nil?
24
24
 
25
+ @coverage_path = nil # invalidate cache
25
26
  @root = File.expand_path(root || Dir.getwd)
26
27
  end
27
28
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov-html"
4
+ module SimpleCov
5
+ module Formatter
6
+ class << self
7
+ def from_env(env)
8
+ formatters = [SimpleCov::Formatter::HTMLFormatter]
9
+
10
+ # When running under a CI that uses CodeClimate, JSON output is expected
11
+ if env.fetch("CC_TEST_REPORTER_ID", nil)
12
+ require "simplecov_json_formatter"
13
+ formatters.push(SimpleCov::Formatter::JSONFormatter)
14
+ end
15
+
16
+ formatters
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Load default formatter gem
4
- require "simplecov-html"
5
4
  require "pathname"
5
+ require_relative "default_formatter"
6
6
  require_relative "profiles/root_filter"
7
7
  require_relative "profiles/test_frameworks"
8
8
  require_relative "profiles/bundler_filter"
@@ -11,7 +11,10 @@ require_relative "profiles/rails"
11
11
 
12
12
  # Default configuration
13
13
  SimpleCov.configure do
14
- formatter SimpleCov::Formatter::HTMLFormatter
14
+ formatter SimpleCov::Formatter::MultiFormatter.new(
15
+ SimpleCov::Formatter.from_env(ENV)
16
+ )
17
+
15
18
  load_profile "bundler_filter"
16
19
  load_profile "hidden_filter"
17
20
  # Exclude files outside of SimpleCov.root
@@ -17,14 +17,14 @@ module SimpleCov
17
17
  end
18
18
 
19
19
  def self.no_cov_line?(line)
20
- line =~ no_cov_line
20
+ no_cov_line.match?(line)
21
21
  rescue ArgumentError
22
22
  # E.g., line contains an invalid byte sequence in UTF-8
23
23
  false
24
24
  end
25
25
 
26
26
  def self.whitespace_line?(line)
27
- line =~ WHITESPACE_OR_COMMENT_LINE
27
+ WHITESPACE_OR_COMMENT_LINE.match?(line)
28
28
  rescue ArgumentError
29
29
  # E.g., line contains an invalid byte sequence in UTF-8
30
30
  false
@@ -56,7 +56,7 @@ module SimpleCov
56
56
  # Returns true if this line was skipped, false otherwise. Lines are skipped if they are wrapped with
57
57
  # # :nocov: comment lines.
58
58
  def skipped?
59
- !!skipped
59
+ skipped
60
60
  end
61
61
 
62
62
  # The status of this line - either covered, missed, skipped or never. Useful i.e. for direct use
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleCov
4
- VERSION = "0.19.1"
4
+ VERSION = "0.20.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-25 00:00:00.000000000 Z
12
+ date: 2020-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: docile
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0.11'
42
+ - !ruby/object:Gem::Dependency
43
+ name: simplecov_json_formatter
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.1'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.1'
42
56
  description: Code coverage for Ruby with a powerful configuration library and automatic
43
57
  merging of coverage across test suites
44
58
  email:
@@ -67,6 +81,7 @@ files:
67
81
  - lib/simplecov/command_guesser.rb
68
82
  - lib/simplecov/configuration.rb
69
83
  - lib/simplecov/coverage_statistics.rb
84
+ - lib/simplecov/default_formatter.rb
70
85
  - lib/simplecov/defaults.rb
71
86
  - lib/simplecov/exit_codes.rb
72
87
  - lib/simplecov/exit_codes/exit_code_handling.rb
@@ -104,9 +119,9 @@ licenses:
104
119
  metadata:
105
120
  bug_tracker_uri: https://github.com/simplecov-ruby/simplecov/issues
106
121
  changelog_uri: https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md
107
- documentation_uri: https://www.rubydoc.info/gems/simplecov/0.19.1
122
+ documentation_uri: https://www.rubydoc.info/gems/simplecov/0.20.0
108
123
  mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov
109
- source_code_uri: https://github.com/simplecov-ruby/simplecov/tree/v0.19.1
124
+ source_code_uri: https://github.com/simplecov-ruby/simplecov/tree/v0.20.0
110
125
  post_install_message:
111
126
  rdoc_options: []
112
127
  require_paths: