Projects
Mega:23.09
rubygem-simplecov
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:rubygem-simplecov.spec
Changed
@@ -2,7 +2,7 @@ %global rubyabi 1.9.1 Summary: Code coverage analysis tool for Ruby 1.9 Name: rubygem-%{gem_name} -Version: 0.13.0 +Version: 0.19.1 Release: 1 License: MIT URL: http://github.com/colszowka/simplecov @@ -45,7 +45,6 @@ rm -rf %{buildroot}%{gem_instdir}/.yardoc rm -f %{buildroot}%{gem_instdir}/Gemfile rm -f %{buildroot}%{gem_instdir}/simplecov.gemspec -chmod 0755 %{buildroot}%{gem_instdir}/Rakefile mv %{buildroot}%{gem_instdir}/doc %{buildroot}/%{gem_docdir}/ %check @@ -57,21 +56,25 @@ %files %dir %{gem_instdir} -%doc %{gem_instdir}/MIT-LICENSE -%{gem_instdir}/cucumber.yml -%{gem_instdir}/features +%doc %{gem_instdir}/LICENSE %{gem_libdir} %exclude %{gem_cache} %{gem_spec} %files doc %doc %{gem_docdir} -%{gem_instdir}/spec -%{gem_instdir}/Rakefile %{gem_instdir}/CHANGELOG.md %{gem_instdir}/README.md %{gem_instdir}/CONTRIBUTING.md +%{gem_instdir}/CODE_OF_CONDUCT.md +%{gem_instdir}/ISSUE_TEMPLATE.md %changelog +* Mon Nov 13 2023 Ge Wang <wang__ge@126.com> - 0.19.1-1 +- update to version 0.19.1 +- No more warnings triggered by enable_for_subprocesses. +- Avoid trying to patch Process.fork when it isn't available. +- Dropped support for Ruby 2.4, it reached EOL + * Wed Aug 19 2020 maminjie <maminjie1@huawei.com> - 0.13.0-1 - package init
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/rubygem-simplecov.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:simplecov-0.13.0.gem/data/.gitignore
Deleted
@@ -1,31 +0,0 @@ -.bundle -Gemfile.lock -gemfiles/*.lock - -## MAC OS -.DS_Store -.document - -## TEXTMATE -*.tmproj -tmtags - -## EMACS -*~ -\#* -.\#* - -## VIM -*.swp - -## PROJECT::GENERAL -coverage -rdoc -pkg -tmp -capybara*.html -.rvmrc - -## PROJECT::SPECIFIC - -.yardoc
View file
_service:tar_scm:simplecov-0.13.0.gem/data/.rspec
Deleted
@@ -1,3 +0,0 @@ ---color ---order random ---warning
View file
_service:tar_scm:simplecov-0.13.0.gem/data/.rubocop.yml
Deleted
@@ -1,84 +0,0 @@ -AllCops: - Exclude: - - 'spec/fixtures/iso-8859.rb' - - 'tmp/**/*' - - 'vendor/bundle/**/*' - -Bundler/OrderedGems: - Enabled: false - -Lint/AmbiguousRegexpLiteral: - Exclude: - - 'features/**/*_steps.rb' - - 'spec/**/*_steps.rb' - - 'tmp/**/*_steps.rb' - -Metrics/AbcSize: - Max: 25 # TODO: Lower to 15 - -Metrics/BlockLength: - Exclude: - - 'spec/**/*.rb' - -Metrics/BlockNesting: - Max: 2 - -Metrics/LineLength: - AllowURI: true - Enabled: false - -Metrics/MethodLength: - CountComments: false - Max: 12 # TODO: Lower to 10 - -Metrics/ParameterLists: - Max: 4 - CountKeywordArgs: true - -Style/AccessModifierIndentation: - EnforcedStyle: outdent - -Style/CollectionMethods: - PreferredMethods: - map: 'collect' - reduce: 'inject' - find: 'detect' - find_all: 'select' - -Style/Documentation: - Enabled: false - -Style/DoubleNegation: - Enabled: false - -Style/HashSyntax: - EnforcedStyle: hash_rockets - -Style/RegexpLiteral: - Enabled: false - -Style/SpaceInsideHashLiteralBraces: - EnforcedStyle: no_space - -Style/SpecialGlobalVars: - Exclude: - - 'spec/deleted_source_spec.rb' - - 'spec/return_codes_spec.rb' - - 'lib/simplecov/defaults.rb' - -Style/StringLiterals: - EnforcedStyle: double_quotes - -Style/FileName: - Exclude: - - 'spec/fixtures/utf-8.rb' - -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma - -Style/GuardClause: - Enabled: false - -Style/MutableConstant: - Exclude: - - 'lib/simplecov/version.rb' # required for older versions of rubygems
View file
_service:tar_scm:simplecov-0.13.0.gem/data/.travis.yml
Deleted
@@ -1,32 +0,0 @@ -language: ruby - -before_install: - - gem update --system - - gem install bundler - -bundler_args: --without development --jobs=3 --retry=3 - -cache: bundler - -sudo: false - -rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 - - 2.1.10 - - 2.2.6 - - 2.3.3 - - 2.4.0 - - ruby-head - - jruby-head - - jruby-9.1.7.0 - - rbx-2 - -matrix: - allow_failures: - - rvm: ruby-head - - rvm: jruby-head - - rvm: jruby-9.1.7.0 - - rvm: rbx-2 - fast_finish: true
View file
_service:tar_scm:simplecov-0.13.0.gem/data/.yardopts
Deleted
@@ -1,1 +0,0 @@ -- **/*.md
View file
_service:tar_scm:simplecov-0.13.0.gem/data/Gemfile
Deleted
@@ -1,38 +0,0 @@ -source "https://rubygems.org" - -# Uncomment this to use local copy of simplecov-html in development when checked out -# gem 'simplecov-html', :path => ::File.dirname(__FILE__) + '/../simplecov-html' - -# Uncomment this to use development version of html formatter from github -# gem 'simplecov-html', :github => 'colszowka/simplecov-html' - -gem "rake", Gem::Version.new(RUBY_VERSION) < Gem::Version.new("1.9.3") ? "~>10.3" : ">= 10.3" - -group :test do - gem "rspec", ">= 3.2" - # Older versions of some gems required for Ruby 1.8.7 support - platforms :ruby_18 do - gem "activesupport", "~> 3.2.21" - gem "i18n", "~> 0.6.11" - end - platforms :ruby_18, :ruby_19 do - gem "mime-types", "~> 1.25" - gem "addressable", "~> 2.3.0" - end - platforms :ruby_18, :ruby_19, :ruby_20, :ruby_21 do - gem "rack", "~> 1.6" - end - platforms :jruby, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25 do - gem "aruba", "~> 0.7.4" - gem "capybara" - gem "nokogiri", RUBY_VERSION < "2.1" ? "~> 1.6.0" : ">= 1.7" - gem "cucumber" - gem "phantomjs", "~> 1.9" - gem "poltergeist" - gem "rubocop" unless RUBY_VERSION.start_with?("1.") - gem "test-unit" - end - gem "json", RUBY_VERSION.start_with?("1.") ? "~> 1.8" : "~> 2.0" -end - -gemspec
View file
_service:tar_scm:simplecov-0.13.0.gem/data/MIT-LICENSE
Deleted
@@ -1,20 +0,0 @@ -Copyright (c) 2010-2015 Christoph Olszowka - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View file
_service:tar_scm:simplecov-0.13.0.gem/data/Rakefile
Deleted
@@ -1,41 +0,0 @@ -#!/usr/bin/env rake - -require "rubygems" -require "bundler/setup" -Bundler::GemHelper.install_tasks - -# See https://github.com/colszowka/simplecov/issues/171 -desc "Set permissions on all files so they are compatible with both user-local and system-wide installs" -task :fix_permissions do - system 'bash -c "find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;"' -end -# Enforce proper permissions on each build -Rake::Task:build.prerequisites.unshift :fix_permissions - -require "rspec/core/rake_task" -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = FileList"spec/*_spec.rb" -end - -begin - require "rubocop/rake_task" - RuboCop::RakeTask.new -rescue LoadError - task :rubocop do - $stderr.puts "Rubocop is disabled" - end -end - -# Cucumber integration test suite is for impls that work with simplecov only - a.k.a. 1.9+ -if RUBY_VERSION.start_with? "1.8" - task :default => :spec -else - require "cucumber/rake/task" - Cucumber::Rake::Task.new - - if RUBY_VERSION.start_with? "1.9" - task :default => :spec, :cucumber - else - task :default => :spec, :cucumber, :rubocop - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/cucumber.yml
Deleted
@@ -1,13 +0,0 @@ -<% -rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV'CUCUMBER_FORMAT' || 'progress'} features" : "--format #{ENV'CUCUMBER_FORMAT' || 'pretty'} #{rerun}" -std_opts = "--format #{ENV'CUCUMBER_FORMAT' || 'progress'} --strict --tags ~@wip" -interp_opts = if defined?(RUBY_ENGINE) - " --tags ~@exclude-#{RUBY_ENGINE}" -else - '' -end -%> -default: <%= std_opts %><%= interp_opts %> features -wip: --tags @wip:30 --wip features<%= interp_opts %> -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip<%= interp_opts %>
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_autoload.feature
Deleted
@@ -1,46 +0,0 @@ -@test_unit @rspec @config -Feature: - - If you have multiple test suites, it can be a bit cumbersome - to keep the configuration across them in sync. SimpleCov - is able to find a config file called '.simplecov' that resides - in your project's root and will automatically use it when - loaded. - - This gives you the ability to configure SimpleCov just once - and then use the same configuration on all test suites simply - by doing a 'require "simplecov"' - - Scenario: - Given a file named ".simplecov" with: - """ - SimpleCov.start do - add_filter 'test.rb' - add_filter 'spec.rb' - end - """ - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - """ - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - """ - - When I successfully run `bundle exec rake test` - And I open the coverage report generated with `bundle exec rspec spec` - Then the report should be based upon: - | RSpec | - | Unit Tests | - - And I should see the groups: - | name | coverage | files | - | All Files | 90.48% | 4 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 87.5 % | - | lib/faked_project/meta_magic.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_command_name.feature
Deleted
@@ -1,45 +0,0 @@ -@test_unit @rspec @merging @config -Feature: Custom names for individual test suites - - Each test suite needs a name it can be identified by. SimpleCov tries - best to detect Rails' Unit, Functional, Integration tests as well as regular - Test/Unit, RSpec and Cucumber, but if that is insufficient, each test suite - config can be given a custom command name using SimpleCov.command_name. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - command_name "I'm in UR Unitz" - end - """ - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start do - command_name "Dreck macht Speck" - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then the report should be based upon: - | I'm in UR Unitz | - - When I open the coverage report generated with `bundle exec rspec spec` - Then the report should be based upon: - | Dreck macht Speck | - | I'm in UR Unitz | - - Scenario: RSpec auto detection with spec/features - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start - """ - And a file named "spec/features/foobar_spec.rb" with: - """ - """ - When I open the coverage report generated with `bundle exec rspec spec` - Then the report should be based upon: - | RSpec |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_coverage_dir.feature
Deleted
@@ -1,33 +0,0 @@ -@test_unit @config -Feature: - - The output directory for test coverage can be customized - with the SimpleCov.coverage_dir setting. All coverage reports - will be put there instead of the default 'coverage' directory - in your project's root. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - coverage_dir 'test/simplecov' - end - """ - - When I successfully run `bundle exec rake test` - Then a coverage report should have been generated in "test/simplecov" - And a directory named "coverage" should not exist - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - coverage_dir '/tmp/test/simplecov' - end - """ - - When I successfully run `bundle exec rake test` - Then a coverage report should have been generated in "/tmp/test/simplecov" - And a directory named "coverage" should not exist
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_deactivate_merging.feature
Deleted
@@ -1,42 +0,0 @@ -@test_unit @rspec @merging @config -Feature: - - If merging of test suite results is not desired, it can be deactivated, - thus leading to the coverage report being overwritten with the latest results - of a single test suite on each run of any suite. - - It's probably preferrable to generate the individual suite results into separate - output directories instead (see SimpleCov.coverage_dir), but it is possible :) - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - use_merging false - end - """ - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start do - use_merging false - end - """ - - When I successfully run `bundle exec rake test` - Then a file named "coverage/index.html" should exist - But a file named "coverage/.resultset.json" should not exist - - Given I open the coverage report - Then the report should be based upon: - | Unit Tests | - - When I successfully run `bundle exec rspec spec` - Then a file named "coverage/index.html" should exist - But a file named "coverage/.resultset.json" should not exist - - Given I open the coverage report - Then the report should be based upon: - | RSpec | -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_formatters.feature
Deleted
@@ -1,77 +0,0 @@ -@test_unit @config -Feature: - - The formatter for test coverage can be customized - with the SimpleCov.formatter setting. There are two - built-in formatters: - SimpleCov::Formatter::SimpleFormatter is a simple - formatter returning a string of all files with - theirs coverages. - SimpleCov::Formatter::MultiFormatter is a formatter - used to call multiple formatters at once. - - Scenario: With SimpleFormatter - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter - SimpleCov.at_exit do - puts SimpleCov.result.format! - end - SimpleCov.start do - add_group 'Libs', 'lib/faked_project/' - end - """ - - When I successfully run `bundle exec rake test` - Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)" - - Scenario: With MultiFormatter - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.formatters = - SimpleCov::Formatter::SimpleFormatter, - Class.new do - def format(result) - raise "Unable to format" - end - end - - - SimpleCov.at_exit do - puts SimpleCov.result.format!.join - end - SimpleCov.start do - add_group 'Libs', 'lib/faked_project/' - end - """ - - When I successfully run `bundle exec rake test` - Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)" - And the output should match /Formatter ^\s* failed with RuntimeError: Unable to format/ - - Scenario: With multiple formatters - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.formatters = - SimpleCov::Formatter::SimpleFormatter, - Class.new do - def format(result) - raise "Unable to format" - end - end - - - SimpleCov.at_exit do - puts SimpleCov.result.format!.join - end - SimpleCov.start do - add_group 'Libs', 'lib/faked_project/' - end - """ - - When I successfully run `bundle exec rake test` - Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)" - And the output should match /Formatter ^\s* failed with RuntimeError: Unable to format/
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_merge_timeout.feature
Deleted
@@ -1,39 +0,0 @@ -@test_unit @rspec @merging @config -Feature: - - The maximum time between resultset merges can be customized - using SimpleCov.merge_timeout SECONDS. This can be helpful for - long-running test-suites that fail to merge because of the time - between individual suite finishes is more then the default timeout - of 10 minutes. - - Here, for the sake of testing the opposite case is shown, choosing - a merge timeout so short that the first test suite's results actually - are out of date when the second suite finishes and thus does not end up - in the report. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - merge_timeout 5 - end - """ - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start do - merge_timeout 5 - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then the report should be based upon: - | Unit Tests | - - When I wait for 5 seconds - And I open the coverage report generated with `bundle exec rspec spec` - Then the report should be based upon: - | RSpec | -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_nocov_token.feature
Deleted
@@ -1,79 +0,0 @@ -@test_unit @nocov -Feature: - - Code wrapped in # :nocov: will be ignored by coverage reports. - The name of the token can be configured with SimpleCov.nocov_token or SimpleCov.skip_token - - Scenario: Custom nocov token using nocov_token - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start 'test_frameworks' do - nocov_token 'skippit' - end - """ - - Given a file named "lib/faked_project/nocov.rb" with: - """ - class SourceCodeWithNocov - # :skippit: - def some_weird_code - never_reached - rescue => err - but no one cares about invalid ruby here - end - # :skippit: - end - """ - - When I open the coverage report generated with `bundle exec rake test` - - Then I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | lib/faked_project/nocov.rb | 100.0 % | - - And there should be 5 skipped lines in the source files - - And the report should be based upon: - | Unit Tests | - - Scenario: Custom nocov token using skip_token - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start 'test_frameworks' do - skip_token 'skippit' - end - """ - - Given a file named "lib/faked_project/nocov.rb" with: - """ - class SourceCodeWithNocov - # :skippit: - def some_weird_code - never_reached - rescue => err - but no one cares about invalid ruby here - end - # :skippit: - end - """ - - When I open the coverage report generated with `bundle exec rake test` - - Then I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | lib/faked_project/nocov.rb | 100.0 % | - - And there should be 5 skipped lines in the source files - - And the report should be based upon: - | Unit Tests |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_profiles.feature
Deleted
@@ -1,44 +0,0 @@ -@test_unit @config @profiles -Feature: - - In order to re-use SimpleCov settings across projects, - profiles can be defined that hold configuration settings - that can be loaded at once. - - Background: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - """ - - Scenario: Defining and using a custom profile - Given a file named ".simplecov" with: - """ - SimpleCov.profiles.define 'custom_command' do - command_name "Profile Command" - end - - SimpleCov.start do - load_profile 'test_frameworks' - load_profile 'custom_command' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Profile Command" within "#footer" - - Scenario: Using existing profile in custom profile and supplying profile to start command - Given a file named ".simplecov" with: - """ - SimpleCov.profiles.define 'my_profile' do - load_profile 'test_frameworks' - command_name "My Profile" - end - - SimpleCov.start 'my_profile' - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using My Profile" within "#footer"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_project_name.feature
Deleted
@@ -1,27 +0,0 @@ -@test_unit @config -Feature: - - SimpleCov guesses the project name from the project root dir's name. - If this is not sufficient for you, you can specify a custom name using - SimpleCov.project_name('xyz') - - - Scenario: Guessed name - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "Code coverage for Project" within "title" - - Scenario: Custom name - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start { project_name "Superfancy 2.0" } - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "Code coverage for Superfancy 2.0" within "title"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_styles.feature
Deleted
@@ -1,121 +0,0 @@ -@test_unit @config -Feature: - - There's several ways to configure SimpleCov. All of those - config schemes below are equivalent and can be chosen by personal - preference or project requirements. - - Background: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - """ - - Scenario: Inside start block - Given a file named ".simplecov" with: - """ - SimpleCov.start do - add_filter 'test' - command_name 'Config Test Runner' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Inside start block, using instance var from outside - Given a file named ".simplecov" with: - """ - @filter = 'test' - SimpleCov.start do - add_filter @filter - command_name 'Config Test Runner' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Inside start block, using local var from outside - Given a file named ".simplecov" with: - """ - filter = 'test' - SimpleCov.start do - add_filter filter - command_name 'Config Test Runner' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Explicitly before start block - Given a file named ".simplecov" with: - """ - SimpleCov.add_filter 'test' - SimpleCov.command_name 'Config Test Runner' - SimpleCov.start - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Explicitly after start block - Given a file named ".simplecov" with: - """ - SimpleCov.start - SimpleCov.add_filter 'test' - SimpleCov.command_name 'Config Test Runner' - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Using configure block after start - Given a file named ".simplecov" with: - """ - SimpleCov.start - SimpleCov.configure do - add_filter 'test' - command_name 'Config Test Runner' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Using configure block before start - Given a file named ".simplecov" with: - """ - SimpleCov.configure do - add_filter 'test' - command_name 'Config Test Runner' - end - SimpleCov.start - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" - - Scenario: Mixing configure and start block config - Given a file named ".simplecov" with: - """ - SimpleCov.configure do - command_name 'Config Test Runner' - end - SimpleCov.start do - add_filter 'test' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see "4 files in total." - And I should see "using Config Test Runner" within "#footer" -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/config_tracked_files.feature
Deleted
@@ -1,29 +0,0 @@ -@test_unit -Feature: - - Using the setting `tracked_files` should add files that were not - required to the report. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - track_files "lib/**/*.rb" - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 76.81% | 7 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/untested_class.rb | 0.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | test/meta_magic_test.rb | 100.0 % | - | test/some_class_test.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/cucumber_basic.feature
Deleted
@@ -1,29 +0,0 @@ -@cucumber -Feature: - - Simply adding the basic simplecov lines to a project should get - the user a coverage report after running `cucumber features` - - Scenario: - Given SimpleCov for Cucumber is configured with: - """ - require 'simplecov' - SimpleCov.start - """ - - When I open the coverage report generated with `bundle exec cucumber features` - Then I should see the groups: - | name | coverage | files | - | All Files | 91.23% | 6 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | features/step_definitions/my_steps.rb | 100.0 % | - | features/support/simplecov_config.rb | 100.0 % | - - And the report should be based upon: - | Cucumber Features |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/maximum_coverage_drop.feature
Deleted
@@ -1,36 +0,0 @@ -@test_unit @config -Feature: - - Exit code should be non-zero if the overall coverage decreases by more than - the maximum_coverage_drop threshold. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - maximum_coverage_drop 3.14 - end - """ - - When I run `bundle exec rake test` - Then the exit status should be 0 - And a file named "coverage/.last_run.json" should exist - - Given a file named "lib/faked_project/missed.rb" with: - """ - class UncoveredSourceCode - def foo - never_reached - rescue => err - but no one cares about invalid ruby here - end - end - """ - - When I run `bundle exec rake test` - Then the exit status should not be 0 - And the output should contain "Coverage has dropped by 3.32% since the last time (maximum allowed: 3.14%)." - And a file named "coverage/.last_run.json" should exist -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/merging_test_unit_and_rspec.feature
Deleted
@@ -1,44 +0,0 @@ -@test_unit @rspec @merging -Feature: - - Test suites like RSpec and Test/Unit should be merged automatically - when both have been run recently. The coverage report will feature - the joined results of all test suites that are using SimpleCov. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - add_filter 'spec.rb' - end - """ - And SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - add_filter 'spec.rb' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then the report should be based upon: - | Unit Tests | - - When I open the coverage report generated with `bundle exec rspec spec` - Then the report should be based upon: - | RSpec | - | Unit Tests | - - And I should see the groups: - | name | coverage | files | - | All Files | 90.48% | 4 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 87.5 % | - | lib/faked_project/meta_magic.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/minimum_coverage.feature
Deleted
@@ -1,59 +0,0 @@ -@test_unit @config -Feature: - - Exit code should be non-zero if the overall coverage is below the - minimum_coverage threshold. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - minimum_coverage 90 - end - """ - - When I run `bundle exec rake test` - Then the exit status should not be 0 - And the output should contain "Coverage (88.10%) is below the expected minimum coverage (90.00%)." - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - minimum_coverage 88.11 - end - """ - - When I run `bundle exec rake test` - Then the exit status should not be 0 - And the output should contain "Coverage (88.10%) is below the expected minimum coverage (88.11%)." - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - minimum_coverage 88.10 - end - """ - - When I run `bundle exec rake test` - Then the exit status should be 0 - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - end - """ - - When I run `bundle exec rake test` - Then the exit status should be 0 -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/refuse_coverage_drop.feature
Deleted
@@ -1,35 +0,0 @@ -@test_unit @config -Feature: - - Exit code should be non-zero if the overall coverage decreases. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_filter 'test.rb' - refuse_coverage_drop - end - """ - - When I run `bundle exec rake test` - Then the exit status should be 0 - And a file named "coverage/.last_run.json" should exist - - Given a file named "lib/faked_project/missed.rb" with: - """ - class UncoveredSourceCode - def foo - never_reached - rescue => err - but no one cares about invalid ruby here - end - end - """ - - When I run `bundle exec rake test` - Then the exit status should not be 0 - And the output should contain "Coverage has dropped by 3.32% since the last time (maximum allowed: 0.00%)." - And a file named "coverage/.last_run.json" should exist -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/rspec_basic.feature
Deleted
@@ -1,32 +0,0 @@ -@rspec -Feature: - - Simply adding the basic simplecov lines to a project should get - the user a coverage report after running `rspec` - - Scenario: - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start - """ - - When I open the coverage report generated with `bundle exec rspec spec` - Then I should see the groups: - | name | coverage | files | - | All Files | 91.8% | 7 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | spec/forking_spec.rb | 100.0 % | - | spec/meta_magic_spec.rb | 100.0 % | - | spec/some_class_spec.rb | 100.0 % | - - # Note: faked_spec.rb is not appearing here since that's the first unit test file - # loaded by Rake, and only there test_helper is required, which then loads simplecov - # and triggers tracking of all other loaded files! Solution for this would be to - # configure simplecov in this first test instead of test_helper.
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/rspec_fails_on_initialization.feature
Deleted
@@ -1,14 +0,0 @@ -@rspec -Feature: - - Running specs with a failing rspec setup - - Scenario: Fail if rspec fails before starting its tests - Given a file named "spec/spec_helper.rb" with: - """ - require 'simplecov' - SimpleCov.start - raise "some exception in the class loading before the tests start" - """ - When I run `bundle exec rspec spec` - Then the exit status should not be 0
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/rspec_groups_and_filters_basic.feature
Deleted
@@ -1,29 +0,0 @@ -@rspec -Feature: - - Defining some groups and filters should give a corresponding - coverage report that respects those settings after running rspec - - Scenario: - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_group 'Libs', 'lib/faked_project/' - add_filter '/spec/' - end - """ - - When I open the coverage report generated with `bundle exec rspec spec` - And I should see the groups: - | name | coverage | files | - | All Files | 88.1% | 4 | - | Libs | 86.11% | 3 | - | Ungrouped | 100.0% | 1 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/rspec_groups_and_filters_complex.feature
Deleted
@@ -1,37 +0,0 @@ -@rspec -Feature: Sophisticated grouping and filtering on RSpec - - Defining groups and filters can be done by passing blocks or strings. - Blocks get each SimpleCov::SourceFile instance passed an can use arbitrary - and potentially weird conditions to remove files from the report or add them - to specific groups. - - Scenario: - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_group 'By block' do |src_file| - src_file.filename =~ /MaGiC/i - end - add_group 'By string', 'project/meta_magic' - add_group 'By array', 'project/meta_magic' - - add_filter 'faked_project.rb' - # Remove all files that include "describe" in their source - add_filter {|src_file| src_file.lines.any? {|line| line.src =~ /describe/ } } - add_filter {|src_file| src_file.covered_percent < 100 } - end - """ - - When I open the coverage report generated with `bundle exec rspec spec` - Then I should see the groups: - | name | coverage | files | - | All Files | 100.0% | 1 | - | By block | 100.0% | 1 | - | By string | 100.0% | 1 | - | By array | 100.0% | 1 | - - And I should see the source files: - | name | coverage | - | lib/faked_project/meta_magic.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/rspec_groups_using_filter_class.feature
Deleted
@@ -1,41 +0,0 @@ -@rspec -Feature: Grouping on RSpec using a custom filter class - - Next to passing a block or a string to define a group, you can also pass - a filter class. The filter class inherits from SimpleCov::Filter and - must implement the matches? method, which is used to determine whether - or not a file should be added to the group. - - Scenario: - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - class CoverageFilter < SimpleCov::Filter - def matches?(source_file) - source_file.covered_percent < filter_argument - end - end - SimpleCov.start do - add_group 'By filter class', CoverageFilter.new(90) - add_group 'By string', 'project/meta_magic' - end - """ - - When I open the coverage report generated with `bundle exec rspec spec` - Then I should see the groups: - | name | coverage | files | - | All Files | 91.8% | 7 | - | By filter class | 78.26% | 2 | - | By string | 100.0% | 1 | - | Ungrouped | 100.0% | 4 | - - And I should see the source files: - | name | coverage | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | spec/forking_spec.rb | 100.0 % | - | spec/meta_magic_spec.rb | 100.0 % | - | spec/some_class_spec.rb | 100.0 % | -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/rspec_without_simplecov.feature
Deleted
@@ -1,20 +0,0 @@ -@rspec -Feature: - - Running specs without simplecov configuration - - Scenario: No config at all - When I successfully run `bundle exec rspec spec` - Then no coverage report should have been generated - - Scenario: Configured, but not started - Given SimpleCov for RSpec is configured with: - """ - require 'simplecov' - SimpleCov.configure do - add_filter 'somefilter' - end - """ - - When I successfully run `bundle exec rspec spec` - Then no coverage report should have been generated
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/skipping_code_blocks_manually.feature
Deleted
@@ -1,70 +0,0 @@ -@test_unit @nocov -Feature: - - When code is wrapped in :nocov: comment blocks, it does not count - against the coverage numbers. - - Background: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start 'test_frameworks' - """ - - Scenario: Plain run with a nocov'd method - Given a file named "lib/faked_project/nocov.rb" with: - """ - class SourceCodeWithNocov - #:nocov: - def some_weird_code - never_reached - rescue => err - but no one cares about invalid ruby here - end - #:nocov: - end - """ - - When I open the coverage report generated with `bundle exec rake test` - - Then I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | lib/faked_project/nocov.rb | 100.0 % | - - And there should be 5 skipped lines in the source files - - And the report should be based upon: - | Unit Tests | - - Scenario: Number of spaces should not mix up nocov results - Given a file named "lib/faked_project/nocov.rb" with: - """ - class SourceCodeWithNocov - # :nocov: - def some_weird_code - never_reached - rescue => err - but no one cares about invalid ruby here - end - # :nocov: - end - """ - - When I open the coverage report generated with `bundle exec rake test` - - Then I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | lib/faked_project/nocov.rb | 100.0 % | - - And there should be 5 skipped lines in the source files - - And the report should be based upon: - | Unit Tests |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/step_definitions/html_steps.rb
Deleted
@@ -1,44 +0,0 @@ -module GroupHelpers - def available_groups - all("#content .file_list_container") - end - - def available_source_files - all(".source_files .source_table") - end -end -World(GroupHelpers) - -Then /^I should see the groups:$/ do |table| - expected_groups = table.hashes - # Given group names should be the same number than those rendered in report - expect(expected_groups.count).to eq(available_groups.count) - - # Verify each of the expected groups has a file list container and corresponding title and coverage number - # as well as the correct number of links to files. - expected_groups.each do |group| - with_scope "#content ##{group'name'.gsub(/^a-z/i, '')}.file_list_container" do - file_count_in_group = page.all("a.src_link").count - expect(file_count_in_group).to eq(group"files".to_i) - - with_scope "h2" do - expect(page).to have_content(group"name") - expect(page).to have_content(group"coverage") - end - end - end -end - -Then /^I should see the source files:$/ do |table| - expected_files = table.hashes - expect(expected_files.length).to eq(available_source_files.count) - - # Find all filenames and their coverage present in coverage report - files = available_source_files.map { |f| {"name" => f.find("h3").text, "coverage" => f.find("h4 > span").text} } - - expect(files.sort_by { |hsh| hsh"name" }).to eq(expected_files.sort_by { |hsh| hsh"name" }) -end - -Then /^there should be (\d+) skipped lines in the source files$/ do |expected_count| - expect(all(".source_table ol li.skipped").count).to eq(expected_count.to_i) -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/step_definitions/simplecov_steps.rb
Deleted
@@ -1,68 +0,0 @@ -# Just a shortcut to make framework setup more readable -# The test project is using separate config files to avoid specifying all of -# test/spec_helper in the features every time. -Given /^SimpleCov for (.*) is configured with:$/ do |framework, config_body| - framework_dir = begin - case framework - when /RSpec/i - "spec" - when /Test\/Unit/i - "test" - when /Cucumber/i - "features/support" - else - raise ArgumentError, "Could not identify test framework #{framework}!" - end - end - - steps %( - Given a file named "#{framework_dir}/simplecov_config.rb" with: - """ - #{config_body} - """ - ) -end - -When /^I open the coverage report generated with `(^`+)`$/ do |command| - steps %( - When I successfully run `#{command}` - Then a coverage report should have been generated - When I open the coverage report - ) -end - -Then /^a coverage report should have been generated(?: in "(^"*)")?$/ do |coverage_dir| - coverage_dir ||= "coverage" - steps %( - Then the output should contain "Coverage report generated" - And a directory named "#{coverage_dir}" should exist - And the following files should exist: - | #{coverage_dir}/index.html | - | #{coverage_dir}/.resultset.json | - ) -end - -Then /^no coverage report should have been generated(?: in "(^"*)")?$/ do |coverage_dir| - coverage_dir ||= "coverage" - steps %( - Then the output should not contain "Coverage report generated" - And a directory named "#{coverage_dir}" should not exist - And the following files should not exist: - | #{coverage_dir}/index.html | - | #{coverage_dir}/.resultset.json | - ) -end - -Then /^the report should be based upon:$/ do |table| - frameworks = table.raw.flatten - steps %( - Then the output should contain "Coverage report generated for #{frameworks.join(', ')}" - And I should see "using #{frameworks.join(', ')}" within "#footer" - ) -end - -# This is neccessary to ensure timing-dependant tests like the merge timeout -# do not fail on powerful machines. -When /^I wait for (\d+) seconds$/ do |seconds| - sleep seconds.to_i -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/step_definitions/transformers.rb
Deleted
@@ -1,13 +0,0 @@ -# -# Enforce the alphabetical execution of specs because rspec 2+ executes them -# randomly with `rspec spec` while we need them in an accurate order for coverage -# reports that include the spec files. -# -# This is due to the fact that coverage will not include the first loaded spec/test file. -# To get predictable coverage results, we need to know which one that is... -# -Transform "bundle exec rspec spec" do |_| - files = nil # Avoid shadowing - in_current_directory { files = Dir"spec/**/*_spec.rb" } - "bundle exec rspec #{files.sort.join(' ')}" -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/step_definitions/web_steps.rb
Deleted
@@ -1,64 +0,0 @@ -module WithinHelpers - def with_scope(locator) - locator ? within(locator) { yield } : yield - end -end -World(WithinHelpers) - -When /^I open the coverage report$/ do - visit "/" -end - -Given /^(?:|I )am on (.+)$/ do |path| - visit path -end - -When /^(?:|I )go to (.+)$/ do |path| - visit path -end - -When /^(?:|I )press "(^"*)"(?: within "(^"*)")?$/ do |button, selector| - with_scope(selector) do - click_button(button) - end -end - -When /^(?:|I )follow "(^"*)"(?: within "(^"*)")?$/ do |link, selector| - with_scope(selector) do - click_link(link) - end -end - -Then /^(?:|I )should see "(^"*)"(?: within "(^"*)")?$/ do |text, selector| - with_scope(selector) do - expect(page).to have_content(text) - end -end - -Then /^(?:|I )should see \/(^\/*)\/(?: within "(^"*)")?$/ do |regexp, selector| - regexp = Regexp.new(regexp) - with_scope(selector) do - expect(page).to have_xpath("//*", :text => regexp) - end -end - -Then /^(?:|I )should not see "(^"*)"(?: within "(^"*)")?$/ do |text, selector| - with_scope(selector) do - expect(page).to have_no_content(text) - end -end - -Then /^(?:|I )should not see \/(^\/*)\/(?: within "(^"*)")?$/ do |regexp, selector| - regexp = Regexp.new(regexp) - with_scope(selector) do - expect(page).to have_no_xpath("//*", :text => regexp) - end -end - -Then /^show me the page$/ do - save_and_open_page # rubocop:disable Lint/Debugger -end - -Then /^print the page$/ do - puts page.body -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/support/env.rb
Deleted
@@ -1,50 +0,0 @@ -if RUBY_VERSION < "1.9" - $stderr.puts "Sorry, Cucumber features are only meant to run on Ruby 1.9+ :(" - exit 0 -end - -require "bundler" -Bundler.setup -require "aruba/cucumber" -require "aruba/jruby" if RUBY_ENGINE == "jruby" -require "capybara/cucumber" -require "phantomjs/poltergeist" - -# Fake rack app for capybara that just returns the latest coverage report from aruba temp project dir -Capybara.app = lambda { |env| - request_path = env"REQUEST_PATH" || "/" - request_path = "/index.html" if request_path == "/" - - 200, - {"Content-Type" => "text/html"}, - File.read(File.join(File.dirname(__FILE__), "../../tmp/aruba/project/coverage", request_path)), - -} - -Capybara.default_driver = Capybara.javascript_driver = :poltergeist - -Capybara.configure do |config| - config.ignore_hidden_elements = false -end - -Before do - # JRuby takes it's time... See https://github.com/cucumber/aruba/issues/134 - @aruba_timeout_seconds = RUBY_ENGINE == "jruby" ? 60 : 20 - - this_dir = File.dirname(__FILE__) - - # Clean up and create blank state for fake project - in_current_directory do - FileUtils.rm_rf "project" - FileUtils.cp_r File.join(this_dir, "../../spec/faked_project/"), "project" - end - - step 'I cd to "project"' -end - -# Workaround for https://github.com/cucumber/aruba/pull/125 -Aruba.configure do |config| - config.before_cmd do - set_env("JRUBY_OPTS", "--dev --debug") - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/test_unit_basic.feature
Deleted
@@ -1,34 +0,0 @@ -@test_unit -Feature: - - Simply adding the basic simplecov lines to a project should get - the user a coverage report after running `rake test` - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 91.38% | 6 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | test/meta_magic_test.rb | 100.0 % | - | test/some_class_test.rb | 100.0 % | - - # Note: faked_test.rb is not appearing here since that's the first unit test file - # loaded by Rake, and only there test_helper is required, which then loads simplecov - # and triggers tracking of all other loaded files! Solution for this would be to - # configure simplecov in this first test instead of test_helper. - - And the report should be based upon: - | Unit Tests |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/test_unit_groups_and_filters_basic.feature
Deleted
@@ -1,29 +0,0 @@ -@test_unit -Feature: - - Defining some groups and filters should give a corresponding - coverage report that respects those settings after running tests - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_group 'Libs', 'lib/faked_project/' - add_filter '/test/' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 88.1% | 4 | - | Libs | 86.11% | 3 | - | Ungrouped | 100.0% | 1 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/test_unit_groups_and_filters_complex.feature
Deleted
@@ -1,35 +0,0 @@ -@test_unit -Feature: Sophisticated grouping and filtering on Test/Unit - - Defining groups and filters can be done by passing blocks or strings. - Blocks get each SimpleCov::SourceFile instance passed an can use arbitrary - and potentially weird conditions to remove files from the report or add them - to specific groups. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start do - add_group 'By block' do |src_file| - src_file.filename =~ /MaGiC/i - end - add_group 'By string', 'project/meta_magic' - - add_filter 'faked_project.rb' - # Remove all files that include "describe" in their source - add_filter {|src_file| src_file.lines.any? {|line| line.src =~ /TestCase/ } } - add_filter {|src_file| src_file.covered_percent < 100 } - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 100.0% | 1 | - | By block | 100.0% | 1 | - | By string | 100.0% | 1 | - - And I should see the source files: - | name | coverage | - | lib/faked_project/meta_magic.rb | 100.0 % |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/test_unit_groups_using_filter_class.feature
Deleted
@@ -1,40 +0,0 @@ -@test_unit -Feature: Grouping on Test/Unit using a custom filter class - - Next to passing a block or a string to define a group, you can also pass - a filter class. The filter class inherits from SimpleCov::Filter and - must implement the matches? method, which is used to determine whether - or not a file should be added to the group. - - Scenario: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - class CoverageFilter < SimpleCov::Filter - def matches?(source_file) - source_file.covered_percent < filter_argument - end - end - SimpleCov.start do - add_group 'By filter class', CoverageFilter.new(90) - add_group 'By string', 'project/meta_magic' - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 91.38% | 6 | - | By filter class | 78.26% | 2 | - | By string | 100.0% | 1 | - | Ungrouped | 100.0% | 3 | - - And I should see the source files: - | name | coverage | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | test/meta_magic_test.rb | 100.0 % | - | test/some_class_test.rb | 100.0 % | -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/test_unit_without_simplecov.feature
Deleted
@@ -1,20 +0,0 @@ -@test_unit -Feature: - - Running unit tests without simplecov configuration - - Scenario: No config at all - When I successfully run `bundle exec rake test` - Then no coverage report should have been generated - - Scenario: Configured, but not started - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.configure do - add_filter 'somefilter' - end - """ - - When I successfully run `bundle exec rake test` - Then no coverage report should have been generated
View file
_service:tar_scm:simplecov-0.13.0.gem/data/features/unicode_compatiblity.feature
Deleted
@@ -1,67 +0,0 @@ -@test_unit @unicode -Feature: - - Files with unicode in their source should be no problem at all for - generating a proper coverage report. - - Background: - Given SimpleCov for Test/Unit is configured with: - """ - require 'simplecov' - SimpleCov.start 'test_frameworks' - """ - - Scenario: Snowman inside method string - Given a file named "lib/faked_project/unicode.rb" with: - """ - # encoding: UTF-8 - class SourceCodeWithUnicode - def self.yell! - puts "☃" - end - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 86.67% | 5 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | lib/faked_project/unicode.rb | 66.67 % | - - And the report should be based upon: - | Unit Tests | - - Scenario: Author name in comment - Given a file named "lib/faked_project/unicode.rb" with: - """ - # encoding: UTF-8 - # author: Javiér Hernández - class SomeClassWrittenByAForeigner - def self.yell! - foo - end - end - """ - - When I open the coverage report generated with `bundle exec rake test` - Then I should see the groups: - | name | coverage | files | - | All Files | 86.67% | 5 | - - And I should see the source files: - | name | coverage | - | lib/faked_project.rb | 100.0 % | - | lib/faked_project/some_class.rb | 80.0 % | - | lib/faked_project/framework_specific.rb | 75.0 % | - | lib/faked_project/meta_magic.rb | 100.0 % | - | lib/faked_project/unicode.rb | 66.67 % | - - And the report should be based upon: - | Unit Tests |
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/jruby_fix.rb
Deleted
@@ -1,42 +0,0 @@ -if defined?(JRUBY_VERSION) && JRUBY_VERSION.to_f < 1.7 - require "jruby" - java_import "org.jruby.ast.NodeType" - - # Coverage for JRuby < 1.7.0 does not work correctly - # - # - does not distinguish lines that cannot be executed - # - does (partial) coverage for files loaded before `Coverage.start`. - # - does not expand a path like `lib/../spec` to `spec`. - # - # This monkey patches Coverage to address those issues - module Coverage - class << self - alias __broken_result__ result - - def result # rubocop:disable Metrics/MethodLength - fixed = {} - __broken_result__.each do |path, executed_lines| - next unless File.file? path - - covered_lines = executed_lines.dup - - process = lambda do |node| - if node.node_type == NodeType::NEWLINENODE - pos = node.position - covered_linespos.line ||= 0 - end - node.child_nodes.each(&process) - end - - processJRuby.parse(File.read(path), path) - - if (first = covered_lines.detect { |x| x }) && first > 0 - fixedFile.expand_path(path) = covered_lines - end - end - - fixed - end - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/merge_helpers.rb
Deleted
@@ -1,37 +0,0 @@ -module SimpleCov - module ArrayMergeHelper - # Merges an array of coverage results with self - def merge_resultset(array) - new_array = dup - array.each_with_index do |element, i| - pair = element, new_arrayi - new_arrayi = if pair.any?(&:nil?) && pair.map(&:to_i).all?(&:zero?) - nil - else - element.to_i + new_arrayi.to_i - end - end - new_array - end - end -end - -module SimpleCov - module HashMergeHelper - # Merges the given Coverage.result hash with self - def merge_resultset(hash) - new_resultset = {} - (keys + hash.keys).each do |filename| - new_resultsetfilename = nil - end - - new_resultset.each_key do |filename| - result1 = selffilename - result2 = hashfilename - new_resultsetfilename = - result1 && result2 ? result1.extend(ArrayMergeHelper).merge_resultset(result2) : (result1 || result2).dup - end - new_resultset - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/railtie.rb
Deleted
@@ -1,7 +0,0 @@ -module SimpleCov - class Railtie < ::Rails::Railtie - rake_tasks do - load "simplecov/railties/tasks.rake" - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/railties/tasks.rake
Deleted
@@ -1,11 +0,0 @@ -require "rake/testtask" -Rake::TestTask.new do |t| - t.name = "simplecov" - t.loader = :direct # uses require() which skips PWD in Ruby 1.9 - t.libs.push "test", "spec", Dir.pwd - t.test_files = FileList"{test,spec}/**/*_{test,spec}.rb" - t.ruby_opts.push "-r", "simplecov", "-e", "SimpleCov.start(:rails)".inspect -end - -require "rake/clean" -CLOBBER.include "coverage"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/simplecov.gemspec
Deleted
@@ -1,27 +0,0 @@ -$LOAD_PATH.push File.expand_path("../lib", __FILE__) -require "simplecov/version" - -Gem::Specification.new do |gem| - gem.name = "simplecov" - gem.version = SimpleCov::VERSION - gem.platform = Gem::Platform::RUBY - gem.authors = "Christoph Olszowka" - gem.email = "christoph at olszowka de" - gem.homepage = "http://github.com/colszowka/simplecov" - gem.description = %(Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites) - gem.summary = gem.description - gem.license = "MIT" - - gem.required_ruby_version = ">= 1.8.7" - - gem.add_dependency "json", ">= 1.8", "< 3" - gem.add_dependency "simplecov-html", "~> 0.10.0" - gem.add_dependency "docile", "~> 1.1.0" - - gem.add_development_dependency "bundler", "~> 1.9" - - gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } - gem.require_paths = "lib" -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/1_8_fallbacks_spec.rb
Deleted
@@ -1,31 +0,0 @@ -require "helper" - -# Tests that verify that on 1.8 versions of ruby, simplecov simply -# does not launch and does not cause errors on the way -# -# TODO: This should be expanded upon all methods that could potentially -# be called in a test/spec-helper simplecov config block -# -if RUBY_VERSION.start_with? "1.8" - describe "Ruby 1.8 fallback" do - it "return false when calling SimpleCov.start" do - expect(SimpleCov.start).to be false - end - - it "return false when calling SimpleCov.start with a block" do - expect(SimpleCov.start { raise "Shouldn't reach this!" }).to be false - end - - it "return false when calling SimpleCov.configure with a block" do - expect(SimpleCov.configure { raise "Shouldn't reach this!" }).to be false - end - - it "allow to define a profile" do - expect do - SimpleCov.profiles.define "testprofile" do - add_filter "/config/" - end - end.not_to raise_error - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/command_guesser_spec.rb
Deleted
@@ -1,48 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe SimpleCov::CommandGuesser do - subject { SimpleCov::CommandGuesser } - it 'correctly guesses "Unit Tests" for unit tests' do - subject.original_run_command = "/some/path/test/units/foo_bar_test.rb" - expect(subject.guess).to eq("Unit Tests") - subject.original_run_command = "test/units/foo.rb" - expect(subject.guess).to eq("Unit Tests") - subject.original_run_command = "test/foo.rb" - expect(subject.guess).to eq("Unit Tests") - subject.original_run_command = "test/{models,helpers,unit}/**/*_test.rb" - expect(subject.guess).to eq("Unit Tests") - end - - it 'correctly guesses "Functional Tests" for functional tests' do - subject.original_run_command = "/some/path/test/functional/foo_bar_controller_test.rb" - expect(subject.guess).to eq("Functional Tests") - subject.original_run_command = "test/{controllers,mailers,functional}/**/*_test.rb" - expect(subject.guess).to eq("Functional Tests") - end - - it 'correctly guesses "Integration Tests" for integration tests' do - subject.original_run_command = "/some/path/test/integration/foo_bar_controller_test.rb" - expect(subject.guess).to eq("Integration Tests") - subject.original_run_command = "test/integration/**/*_test.rb" - expect(subject.guess).to eq("Integration Tests") - end - - it 'correctly guesses "Cucumber Features" for cucumber features' do - subject.original_run_command = "features" - expect(subject.guess).to eq("Cucumber Features") - subject.original_run_command = "cucumber" - expect(subject.guess).to eq("Cucumber Features") - end - - it 'correctly guesses "RSpec" for RSpec' do - subject.original_run_command = "/some/path/spec/foo.rb" - expect(subject.guess).to eq("RSpec") - end - - it "defaults to RSpec because RSpec constant is defined" do - subject.original_run_command = "some_arbitrary_command with arguments" - expect(subject.guess).to eq("RSpec") - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/deleted_source_spec.rb
Deleted
@@ -1,12 +0,0 @@ -require "helper" - -# Test to verify correct handling of deleted files -# See https://github.com/colszowka/simplecov/issues/9 -describe "A source file which is subsequently deleted" do - it "does not cause an error" do - Dir.chdir(File.join(File.dirname(__FILE__), "fixtures")) do - `ruby deleted_source_sample.rb` - expect($?.exitstatus).to be_zero - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/Gemfile
Deleted
@@ -1,6 +0,0 @@ -source "https://rubygems.org" - -gem "simplecov", :path => "../../../" -gem "rake" -gem "rspec", ">= 2.6.0" -gem "cucumber"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/Rakefile
Deleted
@@ -1,8 +0,0 @@ -require "bundler" - -require "rake/testtask" -Rake::TestTask.new(:test) do |test| - test.libs << "lib" << "test" - test.test_files = FileList"test/**/*_test.rb".sort - test.verbose = true -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/cucumber.yml
Deleted
@@ -1,13 +0,0 @@ -<% -rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV'CUCUMBER_FORMAT' || 'progress'} features" : "--format #{ENV'CUCUMBER_FORMAT' || 'pretty'} #{rerun}" -std_opts = "--format #{ENV'CUCUMBER_FORMAT' || 'progress'} --strict --tags ~@wip" -interp_opts = if defined?(RUBY_ENGINE) - " --tags ~@exclude-#{RUBY_ENGINE}" -else - '' -end -%> -default: <%= std_opts %><%= interp_opts %> features -wip: --tags @wip:30 --wip features<%= interp_opts %> -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip<%= interp_opts %>
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/features/step_definitions/my_steps.rb
Deleted
@@ -1,22 +0,0 @@ -Given /^I want to keep stuff simple$/ do - expect(1).to eq(1) -end - -When /^I write my cukes for the fake project$/ do - expect(1).to eq(1) -end - -Then /^I make all neccessary tests in a single step$/ do - expect(FakedProject.foo).to eq("bar") - - expect(FrameworkSpecific.cucumber).to eq("Only tested in Cucumber") - - expect(FakedProject.a_class_method).to eq("this is a mixed-in class method") - - expect(FakedProject.new.an_instance_method).to eq("this is a mixed-in instance method") - expect(FakedProject.new.dynamic).to eq("A dynamically defined instance method") - - something = SomeClass.new("foo") - expect(something.reverse).to eq("oof") - expect(something.compare_with("foo")).to be true -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/features/support/env.rb
Deleted
@@ -1,12 +0,0 @@ -require "bundler/setup" - -# We're injecting simplecov_config via aruba in cucumber here -# depending on what the test case is... -begin - require File.join(File.dirname(__FILE__), "simplecov_config") -rescue LoadError - $stderr.puts "No SimpleCov config file found!" -end - -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "/../../lib")) -require "faked_project"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/features/test_stuff.feature
Deleted
@@ -1,6 +0,0 @@ -Feature: Foo - - Scenario: Test stuff - Given I want to keep stuff simple - When I write my cukes for the fake project - Then I make all neccessary tests in a single step
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/lib/faked_project.rb
Deleted
@@ -1,11 +0,0 @@ -class FakedProject - def self.foo - "bar" - end -end - -DirFile.join(File.dirname(__FILE__), "faked_project/*.rb").reject { |f| /untested/.match(f) }.each do |file| - require file # Require all source files in project dynamically so we can inject some stuff depending on test situation -end - -FakedProject.send :include, MetaMagic
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/lib/faked_project/framework_specific.rb
Deleted
@@ -1,18 +0,0 @@ -# A pile of methods that only get tested in their frameworks -# and thus make this file only 100% covered when all framework test -# results are merged -module FrameworkSpecific - class << self - def cucumber - "Only tested in Cucumber" - end - - def rspec - "Only tested in RSpec" - end - - def test_unit - "Only tested in Test/Unit" - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/lib/faked_project/meta_magic.rb
Deleted
@@ -1,24 +0,0 @@ -module MetaMagic - module ClassMethods - def a_class_method - "this is a mixed-in class method" - end - end - - module InstanceMethods - def an_instance_method - "this is a mixed-in instance method" - end - end - - def self.included(base) - base.send :extend, ClassMethods - base.send :include, InstanceMethods - - base.class_eval do - define_method :dynamic do - "A dynamically defined instance method" - end - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/lib/faked_project/some_class.rb
Deleted
@@ -1,28 +0,0 @@ -class SomeClass - attr_reader :label - attr_accessor :some_attr - - def initialize(label) - @label = label - end - - def reverse - label.reverse - end - - def compare_with(item) - if item == label - return true - else - raise "Item does not match label" - end - rescue - false - end - -private - - def uncovered - "private method" - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/lib/faked_project/untested_class.rb
Deleted
@@ -1,11 +0,0 @@ -class UntestedClass - def initialize(yogurts) - @yogurts = yogurts - end - - def power_level - @yogurts.map do |yo| - yo.experience_points**2 - end.reduce(0, &:+) - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/spec/faked_spec.rb
Deleted
@@ -1,11 +0,0 @@ -require "spec_helper" - -describe FakedProject do - it "should return proper foo" do - expect(FakedProject.foo).to eq("bar") - end - - it "should test it's framework specific method" do - expect(FrameworkSpecific.rspec).to eq("Only tested in RSpec") - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/spec/forking_spec.rb
Deleted
@@ -1,8 +0,0 @@ -require "spec_helper" - -describe "forking" do - it do - # TODO: The defined?(RUBY_ENGINE) check can be dropped for simplecov 1.0.0 - Process.waitpid(Kernel.fork {}) unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/spec/meta_magic_spec.rb
Deleted
@@ -1,15 +0,0 @@ -require "spec_helper" - -describe FakedProject do - it "should have added a class method to FakedProject" do - expect(FakedProject.a_class_method).to eq("this is a mixed-in class method") - end - - it "should have added a mixed-in instance method to FakedProject" do - expect(subject.an_instance_method).to eq("this is a mixed-in instance method") - end - - it "should have added a dyntamically-defined instance method to FakedProject" do - expect(subject.dynamic).to eq("A dynamically defined instance method") - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/spec/some_class_spec.rb
Deleted
@@ -1,13 +0,0 @@ -require "spec_helper" - -describe SomeClass do - subject { SomeClass.new("foo") } - - it "should be reversible" do - expect(subject.reverse).to eq("oof") - end - - it "should compare with 'foo'" do - expect(subject.compare_with("foo")).to be true - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/spec/spec_helper.rb
Deleted
@@ -1,11 +0,0 @@ -require "bundler/setup" - -# We're injecting simplecov_config via aruba in cucumber here -# depending on what the test case is... -begin - require File.join(File.dirname(__FILE__), "simplecov_config") -rescue LoadError - $stderr.puts "No SimpleCov config file found!" -end - -require "faked_project"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/test/faked_test.rb
Deleted
@@ -1,11 +0,0 @@ -require "test_helper" - -class FakedTest < Test::Unit::TestCase - def test_something - assert_equal "bar", FakedProject.foo - end - - def test_framework_specific - assert_equal "Only tested in Test/Unit", FrameworkSpecific.test_unit - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/test/meta_magic_test.rb
Deleted
@@ -1,13 +0,0 @@ -require "test_helper" - -class MetaMagicTest < Test::Unit::TestCase - def test_class_methods - assert_equal "this is a mixed-in class method", FakedProject.a_class_method - end - - def test_instance_methods - p = FakedProject.new - assert_equal "this is a mixed-in instance method", p.an_instance_method - assert_equal "A dynamically defined instance method", p.dynamic - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/test/some_class_test.rb
Deleted
@@ -1,15 +0,0 @@ -require "test_helper" - -class SomeClassTest < Test::Unit::TestCase - def setup - @instance = SomeClass.new("foo") - end - - def test_reverse - assert_equal "oof", @instance.reverse - end - - def test_comparison - assert @instance.compare_with("foo") - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/faked_project/test/test_helper.rb
Deleted
@@ -1,12 +0,0 @@ -require "bundler/setup" - -# We're injecting simplecov_config via aruba in cucumber here -# depending on what the test case is... -begin - require File.join(File.dirname(__FILE__), "simplecov_config") -rescue LoadError - $stderr.puts "No SimpleCov config file found!" -end - -require "faked_project" -require "test/unit"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/file_list_spec.rb
Deleted
@@ -1,50 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe SimpleCov::Result do - subject do - original_result = { - source_fixture("sample.rb") => nil, 1, 1, 1, nil, nil, 1, 1, nil, nil, - source_fixture("app/models/user.rb") => nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, - source_fixture("app/controllers/sample_controller.rb") => nil, 2, 2, 0, nil, nil, 0, nil, nil, nil, - } - SimpleCov::Result.new(original_result).files - end - - it "has 11 covered lines" do - expect(subject.covered_lines).to eq(11) - end - - it "has 3 missed lines" do - expect(subject.missed_lines).to eq(3) - end - - it "has 19 never lines" do - expect(subject.never_lines).to eq(19) - end - - it "has 14 lines of code" do - expect(subject.lines_of_code).to eq(14) - end - - it "has 3 skipped lines" do - expect(subject.skipped_lines).to eq(3) - end - - it "has the correct covered percent" do - expect(subject.covered_percent).to eq(78.57142857142857) - end - - it "has the correct covered percentages" do - expect(subject.covered_percentages).to eq(50.0, 80.0, 100.0) - end - - it "has the correct least covered file" do - expect(subject.least_covered_file).to match(/sample_controller.rb/) - end - - it "has the correct covered strength" do - expect(subject.covered_strength).to eq(0.9285714285714286) - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/filters_spec.rb
Deleted
@@ -1,98 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe SimpleCov::SourceFile do - subject do - SimpleCov::SourceFile.new(source_fixture("sample.rb"), nil, 1, 1, 1, nil, nil, 1, 0, nil, nil) - end - - it "doesn't match a new SimpleCov::StringFilter 'foobar'" do - expect(SimpleCov::StringFilter.new("foobar")).not_to be_matches subject - end - - it "doesn't match a new SimpleCov::StringFilter 'some/path'" do - expect(SimpleCov::StringFilter.new("some/path")).not_to be_matches subject - end - - it "matches a new SimpleCov::StringFilter 'spec/fixtures'" do - expect(SimpleCov::StringFilter.new("spec/fixtures")).to be_matches subject - end - - it "matches a new SimpleCov::StringFilter 'spec/fixtures/sample.rb'" do - expect(SimpleCov::StringFilter.new("spec/fixtures/sample.rb")).to be_matches subject - end - - it "matches a new SimpleCov::StringFilter 'sample.rb'" do - expect(SimpleCov::StringFilter.new("sample.rb")).to be_matches subject - end - - it "doesn't match a new SimpleCov::BlockFilter that is not applicable" do - expect(SimpleCov::BlockFilter.new(proc { |s| File.basename(s.filename) == "foo.rb" })).not_to be_matches subject - end - - it "matches a new SimpleCov::BlockFilter that is applicable" do - expect(SimpleCov::BlockFilter.new(proc { |s| File.basename(s.filename) == "sample.rb" })).to be_matches subject - end - - it "matches a new SimpleCov::ArrayFilter when 'sample.rb' is passed as array" do - expect(SimpleCov::ArrayFilter.new("sample.rb")).to be_matches subject - end - - it "doesn't match a new SimpleCov::ArrayFilter when a file path different than 'sample.rb' is passed as array" do - expect(SimpleCov::ArrayFilter.new("other_file.rb")).not_to be_matches subject - end - - it "matches a new SimpleCov::ArrayFilter when two file paths including 'sample.rb' are passed as array" do - expect(SimpleCov::ArrayFilter.new("sample.rb", "other_file.rb")).to be_matches subject - end - - context "with no filters set up and a basic source file in an array" do - before do - @prev_filters = SimpleCov.filters - SimpleCov.filters = - end - - subject do - SimpleCov::SourceFile.new(source_fixture("sample.rb"), nil, 1, 1, 1, nil, nil, 1, 0, nil, nil) - end - - after do - SimpleCov.filters = @prev_filters - end - - it 'returns 0 items after executing SimpleCov.filtered on files when using a "sample" string filter' do - SimpleCov.add_filter "sample" - expect(SimpleCov.filtered(subject).count).to be_zero - end - - it 'returns 0 items after executing SimpleCov.filtered on files when using a "spec/fixtures" string filter' do - SimpleCov.add_filter "spec/fixtures" - expect(SimpleCov.filtered(subject).count).to be_zero - end - - it 'returns 1 item after executing SimpleCov.filtered on files when using a "fooo" string filter' do - SimpleCov.add_filter "fooo" - expect(SimpleCov.filtered(subject).count).to eq(1) - end - - it "returns 0 items after executing SimpleCov.filtered on files when using a block filter that returns true" do - SimpleCov.add_filter do - true - end - expect(SimpleCov.filtered(subject).count).to be_zero - end - - it "returns 1 item after executing SimpleCov.filtered on files when using an always-false block filter" do - SimpleCov.add_filter do - false - end - expect(SimpleCov.filtered(subject).count).to eq(1) - end - - it "returns a FileList after filtering" do - SimpleCov.add_filter "fooo" - expect(SimpleCov.filtered(subject)).to be_a SimpleCov::FileList - end - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/app/controllers/sample_controller.rb
Deleted
@@ -1,10 +0,0 @@ -# Foo class -class Foo - def initialize - @foo = "baz" - end - - def bar - @foo - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/app/models/user.rb
Deleted
@@ -1,10 +0,0 @@ -# Foo class -class Foo - def initialize - @foo = "baz" - end - - def bar - @foo - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/deleted_source_sample.rb
Deleted
@@ -1,15 +0,0 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..")) -require "lib/simplecov" -SimpleCov.start { command_name "Test" } - -dir = File.expand_path(File.dirname(__FILE__)) -file = File.join(dir, "generated_buddha.rb") -code = %{ - def kill_the_buddha(z) - z**z - end -} -File.open(file, "w") { |f| f.print code } -load file -File.unlink file -raise unless kill_the_buddha(3) == 27
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/frameworks/rspec_bad.rb
Deleted
@@ -1,9 +0,0 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", "..")) -require "lib/simplecov" -require "rspec" -SimpleCov.start -describe "exit status" do - it "should exit with a non-zero exit status when assertion fails" do - expect(1).to eq(2) - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/frameworks/rspec_good.rb
Deleted
@@ -1,9 +0,0 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", "..")) -require "lib/simplecov" -require "rspec" -SimpleCov.start -describe "exit status" do - it "should exit with a zero exit status when assertion fails" do - expect(1).to eq(1) - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/frameworks/testunit_bad.rb
Deleted
@@ -1,9 +0,0 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", "..")) -require "lib/simplecov" -SimpleCov.start -require "test/unit" -class FooTest < Test::Unit::TestCase - def test_foo - assert false - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/frameworks/testunit_good.rb
Deleted
@@ -1,9 +0,0 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "..", "..")) -require "lib/simplecov" -SimpleCov.start -require "test/unit" -class FooTest < Test::Unit::TestCase - def test_foo - assert true - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/iso-8859.rb
Deleted
@@ -1,3 +0,0 @@ - -# localized to Español thus: -
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/resultset1.rb
Deleted
@@ -1,4 +0,0 @@ -puts "foo" -puts "foo" -puts "foo" -puts "foo"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/resultset2.rb
Deleted
@@ -1,4 +0,0 @@ - -class Resultset - VERSION = 2 -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/sample.rb
Deleted
@@ -1,16 +0,0 @@ -# Foo class -class Foo - def initialize - @foo = "baz" - end - - def bar - @foo - end - - #:nocov: - def skipped - @foo * 2 - end - #:nocov: -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/fixtures/utf-8.rb
Deleted
@@ -1,3 +0,0 @@ -# encoding: utf-8 - -puts "135°C"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/helper.rb
Deleted
@@ -1,24 +0,0 @@ -require "simplecov" -require "rspec" - -SimpleCov.coverage_dir("tmp/coverage") - -def source_fixture(filename) - File.expand_path(File.join(File.dirname(__FILE__), "fixtures", filename)) -end - -# Taken from http://stackoverflow.com/questions/4459330/how-do-i-temporarily-redirect-stderr-in-ruby -require "stringio" - -def capture_stderr - # The output stream must be an IO-like object. In this case we capture it in - # an in-memory IO object so we can return the string value. You can assign any - # IO object here. - previous_stderr = $stderr - $stderr = StringIO.new - yield - $stderr.string -ensure - # Restore the previous value of stderr (typically equal to STDERR). - $stderr = previous_stderr -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/merge_helpers_spec.rb
Deleted
@@ -1,126 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe "merge helpers" do - describe "with two faked coverage resultsets" do - before do - SimpleCov.use_merging true - @resultset1 = { - source_fixture("sample.rb") => nil, 1, 1, 1, nil, nil, 1, 1, nil, nil, - source_fixture("app/models/user.rb") => nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, - source_fixture("app/controllers/sample_controller.rb") => nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, - source_fixture("resultset1.rb") => 1, 1, 1, 1, - source_fixture("parallel_tests.rb") => nil, 0, nil, 0, - source_fixture("conditionally_loaded_1.rb") => nil, 0, 1, # loaded only in the first resultset - }.extend(SimpleCov::HashMergeHelper) - - @resultset2 = { - source_fixture("sample.rb") => 1, nil, 1, 1, nil, nil, 1, 1, nil, nil, - source_fixture("app/models/user.rb") => nil, 1, 5, 1, nil, nil, 1, 0, nil, nil, - source_fixture("app/controllers/sample_controller.rb") => nil, 3, 1, nil, nil, nil, 1, 0, nil, nil, - source_fixture("resultset2.rb") => nil, 1, 1, nil, - source_fixture("parallel_tests.rb") => nil, nil, 0, 0, - source_fixture("conditionally_loaded_2.rb") => nil, 0, 1, # loaded only in the second resultset - } - end - - context "a merge" do - subject do - @resultset1.merge_resultset(@resultset2) - end - - it "has proper results for sample.rb" do - expect(subjectsource_fixture("sample.rb")).to eq(1, 1, 2, 2, nil, nil, 2, 2, nil, nil) - end - - it "has proper results for user.rb" do - expect(subjectsource_fixture("app/models/user.rb")).to eq(nil, 2, 6, 2, nil, nil, 2, 0, nil, nil) - end - - it "has proper results for sample_controller.rb" do - expect(subjectsource_fixture("app/controllers/sample_controller.rb")).to eq(nil, 4, 2, 1, nil, nil, 2, 0, nil, nil) - end - - it "has proper results for resultset1.rb" do - expect(subjectsource_fixture("resultset1.rb")).to eq(1, 1, 1, 1) - end - - it "has proper results for resultset2.rb" do - expect(subjectsource_fixture("resultset2.rb")).to eq(nil, 1, 1, nil) - end - - it "has proper results for parallel_tests.rb" do - expect(subjectsource_fixture("parallel_tests.rb")).to eq(nil, nil, nil, 0) - end - - it "has proper results for conditionally_loaded_1.rb" do - expect(subjectsource_fixture("conditionally_loaded_1.rb")).to eq(nil, 0, 1) - end - - it "has proper results for conditionally_loaded_2.rb" do - expect(subjectsource_fixture("conditionally_loaded_2.rb")).to eq(nil, 0, 1) - end - end - - # See Github issue #6 - it "returns an empty hash when the resultset cache file is empty" do - File.open(SimpleCov::ResultMerger.resultset_path, "w+") { |f| f.puts "" } - expect(SimpleCov::ResultMerger.resultset).to be_empty - end - - # See Github issue #6 - it "returns an empty hash when the resultset cache file is not present" do - system "rm #{SimpleCov::ResultMerger.resultset_path}" if File.exist?(SimpleCov::ResultMerger.resultset_path) - expect(SimpleCov::ResultMerger.resultset).to be_empty - end - - context "and results generated from those" do - before do - system "rm #{SimpleCov::ResultMerger.resultset_path}" if File.exist?(SimpleCov::ResultMerger.resultset_path) - @result1 = SimpleCov::Result.new(@resultset1) - @result1.command_name = "result1" - @result2 = SimpleCov::Result.new(@resultset2) - @result2.command_name = "result2" - end - - context "with stored results" do - before do - SimpleCov::ResultMerger.store_result(@result1) - SimpleCov::ResultMerger.store_result(@result2) - end - - it "has stored data in resultset_path JSON file" do - expect(File.readlines(SimpleCov::ResultMerger.resultset_path).length).to be > 50 - end - - it "returns a hash containing keys 'result1' and 'result2' for resultset" do - expect(SimpleCov::ResultMerger.resultset.keys.sort).to eq %w(result1 result2) - end - - it "returns proper values for merged_result" do - expect(SimpleCov::ResultMerger.merged_result.source_files.find { |s| s.filename =~ /user/ }.lines.map(&:coverage)).to eq(nil, 2, 6, 2, nil, nil, 2, 0, nil, nil) - end - - context "with second result way above the merge_timeout" do - before do - @result2.created_at = Time.now - 172_800 # two days ago - SimpleCov::ResultMerger.store_result(@result2) - end - - it "has only one result in SimpleCov::ResultMerger.results" do - expect(SimpleCov::ResultMerger.results.length).to eq(1) - end - end - - context "with merging disabled" do - before { SimpleCov.use_merging false } - - it "returns nil for SimpleCov.result" do - expect(SimpleCov.result).to be_nil - end - end - end - end - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/multi_formatter_spec.rb
Deleted
@@ -1,20 +0,0 @@ -require "helper" - -require "simplecov/formatter/multi_formatter" - -describe SimpleCov::Formatter::MultiFormatter do - describe "." do - # Regression test for https://github.com/colszowka/simplecov/issues/428 - it "constructs a formatter with multiple children" do - # Silence deprecation warnings. - allow(described_class).to receive(:warn) - - children = - SimpleCov::Formatter::SimpleFormatter, - SimpleCov::Formatter::SimpleFormatter, - - - expect(described_class*children.new.formatters).to eq(children) - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/result_spec.rb
Deleted
@@ -1,209 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe "result" do - context "with a (mocked) Coverage.result" do - before do - @prev_filters = SimpleCov.filters - SimpleCov.filters = - @prev_groups = SimpleCov.groups - SimpleCov.groups = {} - @prev_formatter = SimpleCov.formatter - SimpleCov.formatter = nil - end - - after do - SimpleCov.filters = @prev_filters - SimpleCov.groups = @prev_groups - SimpleCov.formatter = @prev_formatter - end - - let(:original_result) do - { - source_fixture("sample.rb") => nil, 1, 1, 1, nil, nil, 1, 1, nil, nil, - source_fixture("app/models/user.rb") => nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, - source_fixture("app/controllers/sample_controller.rb") => nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, - } - end - - context "a simple cov result initialized from that" do - subject { SimpleCov::Result.new(original_result) } - - it "has 3 filenames" do - expect(subject.filenames.count).to eq(3) - end - - it "has 3 source files" do - expect(subject.source_files.count).to eq(3) - subject.source_files.each do |source_file| - expect(source_file).to be_a SimpleCov::SourceFile - end - end - - it "returns an instance of SimpleCov::FileList for source_files and files" do - expect(subject.files).to be_a SimpleCov::FileList - expect(subject.source_files).to be_a SimpleCov::FileList - end - - it "has files equal to source_files" do - expect(subject.files).to eq(subject.source_files) - end - - it "has accurate covered percent" do - # in our fixture, there are 13 covered line (result in 1) in all 15 relevant line (result in non-nil) - expect(subject.covered_percent).to eq(86.66666666666667) - end - - it "has accurate covered percentages" do - expect(subject.covered_percentages).to eq(80.0, 80.0, 100.0) - end - - it "has accurate least covered file" do - expect(subject.least_covered_file).to match(/sample_controller.rb/) - end - - :covered_percent, :covered_percentages, :least_covered_file, :covered_strength, :covered_lines, :missed_lines, :total_lines.each do |msg| - it "responds to #{msg}" do - expect(subject).to respond_to(msg) - end - end - - context "dumped with to_hash" do - it "is a hash" do - expect(subject.to_hash).to be_a Hash - end - - context "loaded back with from_hash" do - let(:dumped_result) do - SimpleCov::Result.from_hash(subject.to_hash) - end - - it "has 3 source files" do - expect(dumped_result.source_files.count).to eq(subject.source_files.count) - end - - it "has the same covered_percent" do - expect(dumped_result.covered_percent).to eq(subject.covered_percent) - end - - it "has the same covered_percentages" do - expect(dumped_result.covered_percentages).to eq(subject.covered_percentages) - end - - it "has the same timestamp" do - expect(dumped_result.created_at.to_i).to eq(subject.created_at.to_i) - end - - it "has the same command_name" do - expect(dumped_result.command_name).to eq(subject.command_name) - end - - it "has the same original_result" do - expect(dumped_result.original_result).to eq(subject.original_result) - end - end - end - end - - context "with some filters set up" do - before do - SimpleCov.add_filter "sample.rb" - end - - it "has 2 files in a new simple cov result" do - expect(SimpleCov::Result.new(original_result).source_files.length).to eq(2) - end - - it "has 80 covered percent" do - expect(SimpleCov::Result.new(original_result).covered_percent).to eq(80) - end - - it "has 80.0, 80.0 covered percentages" do - expect(SimpleCov::Result.new(original_result).covered_percentages).to eq(80.0, 80.0) - end - end - - context "with groups set up for all files" do - before do - SimpleCov.add_group "Models", "app/models" - SimpleCov.add_group "Controllers", "app/controllers" - SimpleCov.add_group "Other" do |src_file| - File.basename(src_file.filename) == "sample.rb" - end - end - - subject do - SimpleCov::Result.new(original_result) - end - - it "has 3 groups" do - expect(subject.groups.length).to eq(3) - end - - it "has user.rb in 'Models' group" do - expect(File.basename(subject.groups"Models".first.filename)).to eq("user.rb") - end - - it "has sample_controller.rb in 'Controllers' group" do - expect(File.basename(subject.groups"Controllers".first.filename)).to eq("sample_controller.rb") - end - - context "and simple formatter being used" do - before do - SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter - end - - it "returns a formatted string with result.format!" do - expect(subject.format!).to be_a String - end - end - - context "and multi formatter being used" do - before do - SimpleCov.formatters = - SimpleCov::Formatter::SimpleFormatter, - SimpleCov::Formatter::SimpleFormatter, - - end - - it "returns an array containing formatted string with result.format!" do - formatted = subject.format! - expect(formatted.count).to eq(2) - expect(formatted.first).to be_a String - end - end - end - - context "with groups set up that do not match all files" do - before do - SimpleCov.configure do - add_group "Models", "app/models" - add_group "Controllers", "app/controllers" - end - end - - subject { SimpleCov::Result.new(original_result) } - - it "has 3 groups" do - expect(subject.groups.length).to eq(3) - end - - it "has 1 item per group" do - subject.groups.each_value do |files| - expect(files.length).to eq(1) - end - end - - it 'has sample.rb in "Ungrouped" group' do - expect(File.basename(subject.groups"Ungrouped".first.filename)).to eq("sample.rb") - end - - it "returns all groups as instances of SimpleCov::FileList" do - subject.groups.each_value do |files| - expect(files).to be_a SimpleCov::FileList - end - end - end - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/return_codes_spec.rb
Deleted
@@ -1,34 +0,0 @@ -require "helper" - -# Make sure that exit codes of tests are propagated properly -# See https://github.com/colszowka/simplecov/issues/5 -describe "return codes" do - context "inside fixtures/frameworks" do - around do |test| - Dir.chdir(File.join(File.dirname(__FILE__), "fixtures", "frameworks")) do - FileUtils.rm_rf("./coverage") - test.call - end - end - - it "has return code 0 when running testunit_good.rb" do - `ruby testunit_good.rb` - expect($?.exitstatus).to be_zero - end - - it "has return code 0 when running rspec_good.rb" do - `rspec rspec_good.rb` - expect($?.exitstatus).to be_zero - end - - it "has non-0 return code when running testunit_bad.rb" do - `ruby testunit_bad.rb` - expect($?.exitstatus).not_to be_zero - end - - it "has return code 1 when running rspec_bad.rb" do - `rspec rspec_bad.rb` - expect($?.exitstatus).not_to be_zero - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/source_file_line_spec.rb
Deleted
@@ -1,155 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe SimpleCov::SourceFile::Line do - context "a source line" do - subject do - SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3) - end - - it 'returns "# the ruby source" as src' do - expect(subject.src).to eq("# the ruby source") - end - - it "returns the same for source as for src" do - expect(subject.src).to eq(subject.source) - end - - it "has line number 5" do - expect(subject.line_number).to eq(5) - end - - it "has equal line_number, line and number" do - expect(subject.line).to eq(subject.line_number) - expect(subject.number).to eq(subject.line_number) - end - - context "flagged as skipped!" do - before do - subject.skipped! - end - it "is not covered" do - expect(subject).not_to be_covered - end - - it "is skipped" do - expect(subject).to be_skipped - end - - it "is not missed" do - expect(subject).not_to be_missed - end - - it "is not never" do - expect(subject).not_to be_never - end - - it "status is skipped" do - expect(subject.status).to eq("skipped") - end - end - end - - context "A source line with coverage" do - subject do - SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3) - end - - it "has coverage of 3" do - expect(subject.coverage).to eq(3) - end - - it "is covered" do - expect(subject).to be_covered - end - - it "is not skipped" do - expect(subject).not_to be_skipped - end - - it "is not missed" do - expect(subject).not_to be_missed - end - - it "is not never" do - expect(subject).not_to be_never - end - - it "status is covered" do - expect(subject.status).to eq("covered") - end - end - - context "A source line without coverage" do - subject do - SimpleCov::SourceFile::Line.new("# the ruby source", 5, 0) - end - - it "has coverage of 0" do - expect(subject.coverage).to be_zero - end - - it "is not covered" do - expect(subject).not_to be_covered - end - - it "is not skipped" do - expect(subject).not_to be_skipped - end - - it "is missed" do - expect(subject).to be_missed - end - - it "is not never" do - expect(subject).not_to be_never - end - - it "status is missed" do - expect(subject.status).to eq("missed") - end - end - - context "A source line with no code" do - subject do - SimpleCov::SourceFile::Line.new("# the ruby source", 5, nil) - end - - it "has nil coverage" do - expect(subject.coverage).to be_nil - end - - it "is not covered" do - expect(subject).not_to be_covered - end - - it "is not skipped" do - expect(subject).not_to be_skipped - end - - it "is not missed" do - expect(subject).not_to be_missed - end - - it "is never" do - expect(subject).to be_never - end - - it "status is never" do - expect(subject.status).to eq("never") - end - end - - it "raises ArgumentError when initialized with invalid src" do - expect { SimpleCov::SourceFile::Line.new(:symbol, 5, 3) }.to raise_error(ArgumentError) - end - - it "raises ArgumentError when initialized with invalid line_number" do - expect { SimpleCov::SourceFile::Line.new("some source", "five", 3) }.to raise_error(ArgumentError) - end - - it "raises ArgumentError when initialized with invalid coverage" do - expect { SimpleCov::SourceFile::Line.new("some source", 5, "three") }.to raise_error(ArgumentError) - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/spec/source_file_spec.rb
Deleted
@@ -1,77 +0,0 @@ -require "helper" - -if SimpleCov.usable? - describe SimpleCov::SourceFile do - COVERAGE_FOR_SAMPLE_RB = nil, 1, 1, 1, nil, nil, 1, 0, nil, nil, nil, nil, nil, nil, nil, nil.freeze - context "a source file initialized with some coverage data" do - subject do - SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB) - end - - it "has a filename" do - expect(subject.filename).not_to be_nil - end - - it "has source equal to src" do - expect(subject.src).to eq(subject.source) - end - - it "has source_lines equal to lines" do - expect(subject.lines).to eq(subject.source_lines) - end - - it "has 16 source lines" do - expect(subject.lines.count).to eq(16) - end - - it "has all source lines of type SimpleCov::SourceFile::Line" do - subject.lines.each do |line| - expect(line).to be_a SimpleCov::SourceFile::Line - end - end - - it "has 'class Foo' as line(2).source" do - expect(subject.line(2).source).to eq("class Foo\n") - end - - it "returns lines number 2, 3, 4, 7 for covered_lines" do - expect(subject.covered_lines.map(&:line)).to eq(2, 3, 4, 7) - end - - it "returns lines number 8 for missed_lines" do - expect(subject.missed_lines.map(&:line)).to eq(8) - end - - it "returns lines number 1, 5, 6, 9, 10, 11, 15, 16 for never_lines" do - expect(subject.never_lines.map(&:line)).to eq(1, 5, 6, 9, 10, 11, 15, 16) - end - - it "returns line numbers 12, 13, 14 for skipped_lines" do - expect(subject.skipped_lines.map(&:line)).to eq(12, 13, 14) - end - - it "has 80% covered_percent" do - expect(subject.covered_percent).to eq(80.0) - end - end - - context "simulating potential Ruby 1.9 defect -- see Issue #56" do - subject do - SimpleCov::SourceFile.new(source_fixture("sample.rb"), COVERAGE_FOR_SAMPLE_RB + nil) - end - - it "has 16 source lines regardless of extra data in coverage array" do - # Do not litter test output with known warning - capture_stderr { expect(subject.lines.count).to eq(16) } - end - - it "prints a warning to stderr if coverage array contains more data than lines in the file" do - captured_output = capture_stderr do - subject.lines - end - - expect(captured_output).to match(/^Warning: coverage data provided/) - end - end - end -end
View file
_service:tar_scm:simplecov-0.13.0.gem/checksums.yaml.gz -> _service:tar_scm:simplecov-0.19.1.gem/checksums.yaml.gz
Changed
@@ -1,7 +1,7 @@ --- -SHA1: - metadata.gz: 15fa4589e25ee4710bdbcec7485a4d8ec7be7abb - data.tar.gz: a1627cf287ce3c70ba2d60e0943f28f90fcdef79 +SHA256: + metadata.gz: 22a798d9e27a53d890729a39af723d247639cfa54895411b88ec43979bf89dfc + data.tar.gz: dabcb66862e3d4c9b8d1236b52539cd4279ecad22fe2af26fca52efeeb50f6e9 SHA512: - metadata.gz: 03a052dcae5923fe19e56f6f20fbd390505f03dca386d51eaca4b525252054856ce492e783e6923ad3b89a46719b89556747b8bbac295513b1d245fba3232e79 - data.tar.gz: e2cd84b984e35dfa0c048f375ed2555f08d4df239d616d7c70289b086b1904394b1344f177ad5d7dd08cfb695fe2c22d5375af8e07da5d773500b034d87d4b1c + metadata.gz: f7f8f019161301a0c727291f6df9cf4e6c7d16212184439f412e8c6e46936037ade769fedba30c8d6ac211383aed291aaa2379445d8ce9b26cc41654b4e16ab6 + data.tar.gz: ea1796d3b02b0fc02c7222457a2a05746e9781e70c4dc37eab2645f3e7028216f1a6383d05a43b33519db95771be169889569bd25448b814e833864bdbaaaad9
View file
_service:tar_scm:simplecov-0.13.0.gem/data/CHANGELOG.md -> _service:tar_scm:simplecov-0.19.1.gem/data/CHANGELOG.md
Changed
@@ -1,19 +1,254 @@ -0.13.0 2016-01-25 (changes(https://github.com/colszowka/simplecov/compare/v0.12.0...v0.13.0)) +0.19.1 (2020-10-25) +========== + +## Bugfixes + +* No more warnings triggered by `enable_for_subprocesses`. Thanks to @mame(https://github.com/mame) +* Avoid trying to patch `Process.fork` when it isn't available. Thanks to @MSP-Greg(https://github.com/MSP-Greg) + +0.19.0 (2020-08-16) +========== + +## Breaking Changes +* Dropped support for Ruby 2.4, it reached EOL + +## Enhancements +* observe forked processes (enable with SimpleCov.enable_for_subprocesses). See #881(https://github.com/simplecov-ruby/simplecov/pull/881), thanks to @robotdana(https://github.com/robotdana) +* SimpleCov distinguishes better that it stopped processing because of a previous error vs. SimpleCov is the originator of said error due to coverage requirements. + +## Bugfixes +* Changing the `SimpleCov.root` combined with the root filtering didn't work. Now they do! Thanks to @deivid-rodriguez(https://github.com/deivid-rodriguez) and see #894(https://github.com/simplecov-ruby/simplecov/pull/894) +* in parallel test execution it could happen that the last coverage result was written to disk when it didn't complete yet, changed to only write it once it's the final result +* if you run parallel tests only the final process will report violations of the configured test coverage, not all previous processes +* changed the parallel_tests merging mechanisms to do the waiting always in the last process, should reduce race conditions + +## Noteworthy +* The repo has moved to https://github.com/simplecov-ruby/simplecov - everything stays the same, redirects should work but you might wanna update anyhow +* The primary development branch is now `main`, not `master` anymore. If you get simplecov directly from github change your reference. For a while `master` will still be occasionally updated but that's no long term solion. + +0.18.5 (2020-02-25) +=================== + +Can you guess? Another bugfix release! + +## Bugfixes +* minitest won't crash if SimpleCov isn't loaded - aka don't execute SimpleCov code in the minitest plugin if SimpleCov isn't loaded. Thanks to @edariedl(https://github.com/edariedl) for the report of the peculiar problem in #877(https://github.com/simplecov-ruby/simplecov/issues/877). + +0.18.4 (2020-02-24) +=================== + +Another small bugfix release 🙈 Fixes SimpleCov running with rspec-rails, which was broken due to our fixed minitest integration. + +## Bugfixes +* SimpleCov will run again correctly when used with rspec-rails. The excellent bug report #873(https://github.com/simplecov-ruby/simplecov/issues/873) by @odlp(https://github.com/odlp) perfectly details what went wrong. Thanks to @adam12(https://github.com/adam12) for the fix #874(https://github.com/simplecov-ruby/simplecov/pull/874). + + +0.18.3 (2020-02-23) +=========== + +Small bugfix release. It's especially recommended to upgrade simplecov-html as well because of bugs in the 0.12.0 release. + +## Bugfixes +* Fix a regression related to file encodings as special characters were missing. Furthermore we now respect the magic `# encoding: ...` comment and read files in the right encoding. Thanks (@Tietew(https://github.com/Tietew)) - see #866(https://github.com/simplecov-ruby/simplecov/pull/866) +* Use `Minitest.after_run` hook to trigger post-run hooks if `Minitest` is present. See #756(https://github.com/simplecov-ruby/simplecov/pull/756) and #855(https://github.com/simplecov-ruby/simplecov/pull/855) thanks (@adam12(https://github.com/adam12)) + +0.18.2 (2020-02-12) +=================== + +Small release just to allow you to use the new simplecov-html. + +## Enhancements +* Relax simplecov-html requirement so that you're able to use 0.12.0(https://github.com/simplecov-ruby/simplecov-html/blob/main/CHANGELOG.md#0120-2020-02-12) + +0.18.1 (2020-01-31) +=================== + +Small Bugfix release. + +## Bugfixes +* Just putting `# :nocov:` on top of a file or having an uneven number of them in general works again and acts as if ignoring until the end of the file. See #846(https://github.com/simplecov-ruby/simplecov/issues/846) and thanks @DannyBen(https://github.com/DannyBen) for the report. + +0.18.0 (2020-01-28) +=================== + +Huge release! Highlights are support for branch coverage (Ruby 2.5+) and dropping support for EOL'ed Ruby versions (< 2.4). +Please also read the other beta patch notes. + +You can run with branch coverage by putting `enable_coverage :branch` into your SimpleCov configuration (like the `SimpleCov.start do .. end` block) + +## Enhancements +* You can now define the minimum expected coverage by criterion like `minimum_coverage line: 90, branch: 80` +* Memoized some internal data structures that didn't change to reduce SimpleCov overhead +* Both `FileList` and `SourceFile` now have a `coverage` method that returns a hash that points from a coverage criterion to a `CoverageStatistics` object for uniform access to overall coverage statistics for both line and branch coverage + +## Bugfixes +* we were losing precision by rounding the covered strength early, that has been removed. **For Formatters** this also means that you may need to round it yourself now. +* Removed an inconsistency in how we treat skipped vs. irrelevant lines (see #565(https://github.com/simplecov-ruby/simplecov/issues/565)) - SimpleCov's definition of 100% is now "You covered everything that you could" so if coverage is 0/0 that's counted as a 100% no matter if the lines were irrelevant or ignored/skipped + +## Noteworthy +* `FileList` stopped inheriting from Array, it includes Enumerable so if you didn't use Array specific methods on it in formatters you should be fine +* We needed to change an internal file format, which we use for merging across processes, to accommodate branch coverage. Sadly CodeClimate chose to use this file to report test coverage. Until a resolution is found the code climate test reporter won't work with SimpleCov for 0.18+, see this issue on the test reporter(https://github.com/codeclimate/test-reporter/issues/413). + +0.18.0.beta3 (2020-01-20) +======================== + +## Enhancements +* Instead of ignoring old `.resultset.json`s that are inside the merge timeout, adapt and respect them + +## Bugfixes +* Remove the constant warning printing if you still have a `.resultset.json` in pre 0.18 layout that is within your merge timeout + +0.18.0.beta2 (2020-01-19) +=================== + +## Enhancements +* only turn on the requested coverage criteria (when activating branch coverage before SimpleCov would also instruct Ruby to take Method coverage) +* Change how branch coverage is displayed, now it's `branch_type: hit_count` which should be more self explanatory. See #830(https://github.com/simplecov-ruby/simplecov/pull/830) for an example and feel free to give feedback! +* Allow early running exit tasks and avoid the `at_exit` hook through the `SimpleCov.run_exit_tasks!` method. (thanks @macumber(https://github.com/macumber)) +* Allow manual collation of result sets through the `SimpleCov.collate` entrypoint. See the README for more details (thanks @ticky(https://github.com/ticky)) +* Within `case`, even if there is no `else` branch declared show missing coverage for it (aka no branch of it). See #825(https://github.com/simplecov-ruby/simplecov/pull/825) +* Stop symbolizing all keys when loading cache (should lead to be faster and consume less memory) +* Cache whether we can use/are using branch coverage (should be slightly faster) + +## Bugfixes +* Fix a crash that happened when an old version of our internal cache file `.resultset.json` was still present + +0.18.0.beta1 (2020-01-05) +=================== + +This is a huge release highlighted by changing our support for ruby versions to 2.4+ (so things that aren't EOL'ed) and finally adding branch coverage support! + +This release is still beta because we'd love for you to test out branch coverage and get your feedback before doing a full release. + +On a personal note from @PragTob(https://github.com/PragTob/) thanks to ruby together(https://rubytogether.org/) for sponsoring this work on SimpleCov making it possible to deliver this and subsequent releases. + +## Breaking +* Dropped support for all EOL'ed rubies meaning we only support 2.4+. Simplecov can no longer be installed on older rubies, but older simplecov releases should still work. (thanks @deivid-rodriguez(https://github.com/deivid-rodriguez)) +* Dropped the `rake simplecov` task that "magically" integreated with rails. It was always undocumented, caused some issues and had some issues(https://github.com/simplecov-ruby/simplecov/issues/689#issuecomment-561572327). Use the integration as described in the README please :) + +## Enhancements + +* Branch coverage is here! Please try it out and test it! You can activate it with `enable_coverage :branch`. See the README for more details. This is thanks to a bunch of people most notably @som4ik(https://github.com/som4ik), @tycooon(https://github.com/tycooon), @stepozer(https://github.com/stepozer), @klyonrad(https://github.com/klyonrad) and your humble maintainers also contributed ;) +* If the minimum coverage is set to be greater than 100, a warning will be shown. See #737(https://github.com/simplecov-ruby/simplecov/pull/737) (thanks @belfazt(https://github.com/belfazt)) +* Add a configuration option to disable the printing of non-successful exit statuses. See #747(https://github.com/simplecov-ruby/simplecov/pull/746) (thanks @JacobEvelyn(https://github.com/JacobEvelyn)) +* Calculating 100% coverage is now stricter, so 100% means 100%. See #680(https://github.com/simplecov-ruby/simplecov/pull/680) thanks @gleseur(https://github.com/gleseur) + +## Bugfixes + +* Add new instance of `Minitest` constant. The `MiniTest` constant (with the capital T) will be removed in the next major release of Minitest. See #757(https://github.com/simplecov-ruby/simplecov/pull/757) (thanks @adam12(https://github.com/adam12)) + +0.17.1 (2019-09-16) +=================== + +Bugfix release for problems with ParallelTests. + +## Bugfixes + +* Avoid hanging with parallel_tests. See #746(https://github.com/simplecov-ruby/simplecov/pull/746) (thanks @annaswims(https://github.com/annaswims)) + +0.17.0 (2019-07-02) +=================== + +Maintenance release with nice convenience features and important bugfixes. +Notably this **will be the last release to support ruby versions that have reached their end of life**. Moving forward official CRuby support will be 2.4+ and JRuby support will be 9.2+. Older versions might still work but no guarantees. + +## Enhancements + +* Per default filter hidden files and folders. See #721(https://github.com/simplecov-ruby/simplecov/pull/721) (thanks Renuo AG(https://www.renuo.ch)) +* Print the exit status explicitly when it's not a successful build so it's easier figure out SimpleCov failed the build in the output. See #688(https://github.com/simplecov-ruby/simplecov/pull/688) (thanks @daemonsy(https://github.com/daemonsy)) + +## Bugfixes + +* Avoid a premature failure exit code when setting `minimum_coverage` in combination with using parallel_tests(https://github.com/grosser/parallel_tests). See #706(https://github.com/simplecov-ruby/simplecov/pull/706) (thanks @f1sherman(https://github.com/f1sherman)) +* Project roots with special characters no longer cause crashes. See #717(https://github.com/simplecov-ruby/simplecov/pull/717) (thanks @deivid-rodriguez(https://github.com/deivid-rodriguez)) +* Avoid continously overriding test results with manual `ResultMergere.store_results` usage. See #674(https://github.com/simplecov-ruby/simplecov/pull/674) (thanks @tomeon(https://github.com/tomeon)) + +0.16.1 (2018-03-16) +=================== + +## Bugfixes + +* Include the LICENSE in the distributed gem again (accidentally removed in 0.16.0). (thanks @tas50) + +0.16.0 (2018-03-15) +=================== + +## Enhancements + +* Relax version constraint on `docile`, per SemVer +* exception that occurred on exit is available as `exit_exception`! See #639(https://github.com/simplecov-ruby/simplecov/pull/639) (thanks @thomas07vt) +* Performance: processing results now runs from 2.5x to 3.75x faster. See #662(https://github.com/simplecov-ruby/simplecov/pull/662) (thanks @BMorearty & @eregon) +* Decrease gem size by only shipping lib and docs + +## Bugfixes + +* (breaking) Stop handling string filters as regular expressions, use the dedicated regex filter if you need that behaviour. See #616(https://github.com/simplecov-ruby/simplecov/pull/616) (thanks @yujinakayama) +* Avoid overwriting the last coverage results on unsuccessful test runs. See #625(https://github.com/simplecov-ruby/simplecov/pull/625) (thanks @thomas07vt) +* Don't crash on invalid UTF-8 byte sequences. (thanks @BMorearty) + +0.15.1 (2017-09-11) (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.15.0...v0.15.1)) +======= + +## Bugfixes + +* Filter directories outside SimpleCov.root that have it as a prefix. See #617(https://github.com/simplecov-ruby/simplecov/pull/617) (thanks @jenseng) +* Fix standard rails profile rails filter (didn't work). See #618(https://github.com/simplecov-ruby/simplecov/pull/618) (thanks @jenseng again!) + +0.15.0 (2017-08-14) (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.14.1...v0.15.0)) +======= + +## Enhancements + +* Ability to use regex filters for removing files from the output. See #589(https://github.com/simplecov-ruby/simplecov/pull/589) (thanks @jsteel) + +## Bugfixes + +* Fix merging race condition when running tests in parallel and merging them. See #570(https://github.com/simplecov-ruby/simplecov/pull/570) (thanks @jenseng) +* Fix relevant lines for unloaded files - comments, skipped code etc. are correctly classified as irrelevant. See #605(https://github.com/simplecov-ruby/simplecov/pull/605) (thanks @odlp) +* Allow using simplecov with frozen-string-literals enabled. See #590(https://github.com/simplecov-ruby/simplecov/pull/590) (thanks @pat) +* Make sure Array Filter can use all other filter types. See #589(https://github.com/simplecov-ruby/simplecov/pull/589) (thanks @jsteel) +* Make sure file names use `Simplecov.root` as base avoiding using full absolute project paths. See #589(https://github.com/simplecov-ruby/simplecov/pull/589) (thanks @jsteel) + +0.14.1 2017-03-18 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.14.0...v0.14.1)) +======== + +## Bugfixes + +* Files that were skipped as a whole/had no relevant coverage could lead to Float errors. See #564(https://github.com/simplecov-ruby/simplecov/pull/564) (thanks to @stevehanson for the report in #563(https://github.com/simplecov-ruby/simplecov/issues/563)) + +0.14.0 2017-03-15 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.13.0...v0.14.0)) +========== + +## Enhancements + +* Officially support JRuby 9.1+ going forward (should also work with previous releases). See #547(https://github.com/simplecov-ruby/simplecov/pull/547) (ping @PragTob when encountering issues) +* Add Channel group to Rails profile, when `ActionCable` is loaded. See #492(https://github.com/simplecov-ruby/simplecov/pull/492) (thanks @BenMorganIO) +* Stop `extend`ing instances of `Array` and `Hash` during merging results avoiding problems frozen results while manually merging results. See #558(https://github.com/simplecov-ruby/simplecov/pull/558) (thanks @aroben) + +## Bugfixes + +* Fix parallel_tests when a thread ends up running no tests. See #533(https://github.com/simplecov-ruby/simplecov/pull/533) (thanks @cshaffer) +* Skip the `:nocov:` comments along with the code that they skip. See #551(https://github.com/simplecov-ruby/simplecov/pull/551) (thanks @ebiven) +* Fix crash when Home environment variable is unset. See #482(https://github.com/simplecov-ruby/simplecov/pull/482) (thanks @waldyr) +* Make track_files work again when explicitly setting it to nil. See #463(https://github.com/simplecov-ruby/simplecov/pull/463) (thanks @craiglittle) +* Do not overwrite .last_run.json file when refuse_coverage_drop option is enabled and the coverage has dropped (lead to you being able to just rerun tests and everything was _fine_). See #553(https://github.com/simplecov-ruby/simplecov/pull/553) (thanks @Miloshes) + +0.13.0 2017-01-25 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.12.0...v0.13.0)) ========== ## Enhancements -* Faster run times when a very large number of files is loaded into SimpleCov. See #520(https://github.com/colszowka/simplecov/pull/520) (thanks @alyssais) -* Only read in source code files that are actually used (faster when files are ignored etc.). See #540(https://github.com/colszowka/simplecov/pull/540) (tahks @yui-knk) +* Faster run times when a very large number of files is loaded into SimpleCov. See #520(https://github.com/simplecov-ruby/simplecov/pull/520) (thanks @alyssais) +* Only read in source code files that are actually used (faster when files are ignored etc.). See #540(https://github.com/simplecov-ruby/simplecov/pull/540) (thanks @yui-knk) ## Bugfixes -* Fix merging of resultsets if a file is missing on one side. See #513(https://github.com/colszowka/simplecov/pull/513) (thanks @hanazuki) -* Fix Ruby 2.4 deprecation warnings by using Integer instead of Fixnum. See #523(https://github.com/colszowka/simplecov/pull/523) (thanks @nobu) -* Force Ruby 2 to json 2. See dc7417d50(https://github.com/colszowka/simplecov/commit/dc7417d5049b1809cea214314c15dd93a5dd964f) (thanks @amatsuda) +* Fix merging of resultsets if a file is missing on one side. See #513(https://github.com/simplecov-ruby/simplecov/pull/513) (thanks @hanazuki) +* Fix Ruby 2.4 deprecation warnings by using Integer instead of Fixnum. See #523(https://github.com/simplecov-ruby/simplecov/pull/523) (thanks @nobu) +* Force Ruby 2 to json 2. See dc7417d50(https://github.com/simplecov-ruby/simplecov/commit/dc7417d5049b1809cea214314c15dd93a5dd964f) (thanks @amatsuda) * Various other gem dependency fixes for different gems on different ruby versions. (thanks @amatsuda) -0.12.0 2016-07-02 (changes(https://github.com/colszowka/simplecov/compare/v0.11.2...v0.12.0)) +0.12.0 2016-07-02 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.11.2...v0.12.0)) ================= ## Enhancements @@ -22,96 +257,96 @@ ## Bugfixes -* Fix coverage rate of the parallel_tests. See #441(https://github.com/colszowka/simplecov/pull/441) (thanks @sinsoku) -* Fix a regression on old rubies that failed to work with the recently introduced frozen VERSION string. See #461(https://github.com/colszowka/simplecov/pull/461) (thanks @leafle) +* Fix coverage rate of the parallel_tests. See #441(https://github.com/simplecov-ruby/simplecov/pull/441) (thanks @sinsoku) +* Fix a regression on old rubies that failed to work with the recently introduced frozen VERSION string. See #461(https://github.com/simplecov-ruby/simplecov/pull/461) (thanks @leafle) -0.11.2 2016-02-03 (changes(https://github.com/colszowka/simplecov/compare/v0.11.1...v0.11.2)) +0.11.2 2016-02-03 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.11.1...v0.11.2)) ================= ## Enhancements -* Do not globally pollute Array and Hash with `merge_resultset` utility methods. See #449(https://github.com/colszowka/simplecov/pull/449) (thanks @amatsuda) -* Do not `mkdir_p` the `coverage_path` on every access of the method (See #453(https://github.com/colszowka/simplecov/pull/453) (thanks @paddor) -* Fixes a Ruby warning related to the `track_files` configuration. See #447(https://github.com/colszowka/simplecov/pull/447) (thanks @craiglittle) -* Add a group for background jobs to default Rails profile. See #442(https://github.com/colszowka/simplecov/pull/442) (thanks @stve) +* Do not globally pollute Array and Hash with `merge_resultset` utility methods. See #449(https://github.com/simplecov-ruby/simplecov/pull/449) (thanks @amatsuda) +* Do not `mkdir_p` the `coverage_path` on every access of the method (See #453(https://github.com/simplecov-ruby/simplecov/pull/453) (thanks @paddor) +* Fixes a Ruby warning related to the `track_files` configuration. See #447(https://github.com/simplecov-ruby/simplecov/pull/447) (thanks @craiglittle) +* Add a group for background jobs to default Rails profile. See #442(https://github.com/simplecov-ruby/simplecov/pull/442) (thanks @stve) ## Bugfixes -* Fix root_filter evaluates SimpleCov.root before initialization. See #437(https://github.com/colszowka/simplecov/pull/437) (thanks @tmtm) +* Fix root_filter evaluates SimpleCov.root before initialization. See #437(https://github.com/simplecov-ruby/simplecov/pull/437) (thanks @tmtm) -0.11.1 2015-12-01 (changes(https://github.com/colszowka/simplecov/compare/v0.11.0...v0.11.1)) +0.11.1 2015-12-01 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.11.0...v0.11.1)) ================= ## Enhancements ## Bugfixes -* Fixed regression in `MultiFormatter.` with multiple arguments. See #431(https://github.com/colszowka/simplecov/pull/431) (thanks @dillondrobena) +* Fixed regression in `MultiFormatter.` with multiple arguments. See #431(https://github.com/simplecov-ruby/simplecov/pull/431) (thanks @dillondrobena) -0.11.0 2015-11-29 (changes(https://github.com/colszowka/simplecov/compare/v0.10.0...v0.11.0)) +0.11.0 2015-11-29 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.10.0...v0.11.0)) ================= ## Enhancements -* Added `SimpleCov.minimum_coverage_by_file` for per-file coverage thresholds. See #392(https://github.com/colszowka/simplecov/pull/392) (thanks @ptashman) -* Added `track_files` configuration option to specify a glob to always include in coverage results, whether or not those files are required. By default, this is enabled in the Rails profile for common Rails directories. See #422(https://github.com/colszowka/simplecov/pull/422) (thanks @hugopeixoto) -* Speed up `root_filter` by an order of magnitude. See #396(https://github.com/colszowka/simplecov/pull/396) (thanks @raszi) +* Added `SimpleCov.minimum_coverage_by_file` for per-file coverage thresholds. See #392(https://github.com/simplecov-ruby/simplecov/pull/392) (thanks @ptashman) +* Added `track_files` configuration option to specify a glob to always include in coverage results, whether or not those files are required. By default, this is enabled in the Rails profile for common Rails directories. See #422(https://github.com/simplecov-ruby/simplecov/pull/422) (thanks @hugopeixoto) +* Speed up `root_filter` by an order of magnitude. See #396(https://github.com/simplecov-ruby/simplecov/pull/396) (thanks @raszi) ## Bugfixes -* Fix warning about global variable `$ERROR_INFO`. See #400(https://github.com/colszowka/simplecov/pull/400) (thanks @amatsuda) -* Actually recurse upward looking for `.simplecov`, as claimed by the documentation, rather than only the working directory. See #423(https://github.com/colszowka/simplecov/pull/423) (thanks @alexdowad) +* Fix warning about global variable `$ERROR_INFO`. See #400(https://github.com/simplecov-ruby/simplecov/pull/400) (thanks @amatsuda) +* Actually recurse upward looking for `.simplecov`, as claimed by the documentation, rather than only the working directory. See #423(https://github.com/simplecov-ruby/simplecov/pull/423) (thanks @alexdowad) -0.10.0 2015-04-18 (changes(https://github.com/colszowka/simplecov/compare/v0.9.2...v0.10.0)) +0.10.0 2015-04-18 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.9.2...v0.10.0)) ================= ## Enhancements - * Add writeup about using with Spring to README. See #341(https://github.com/colszowka/simplecov/issues/341) (thanks @swrobel and @onebree) + * Add writeup about using with Spring to README. See #341(https://github.com/simplecov-ruby/simplecov/issues/341) (thanks @swrobel and @onebree) * Add support to pass in an Array when creating filter groups (original PR #104) - * Filter `/vendor/bundle` by default. See #331(https://github.com/colszowka/simplecov/pull/331) (thanks @andyw8) + * Filter `/vendor/bundle` by default. See #331(https://github.com/simplecov-ruby/simplecov/pull/331) (thanks @andyw8) * Add some helpful singleton methods to the version string. - * Allow array to be passed in a filter. See 375(https://github.com/colszowka/simplecov/pull/375) (thanks @JanStevens) + * Allow array to be passed in a filter. See 375(https://github.com/simplecov-ruby/simplecov/pull/375) (thanks @JanStevens) * Enforce consistent code formatting with RuboCop. ## Bugfixes - * Fix order dependencies in unit tests. See #376(https://github.com/colszowka/simplecov/pull/376) (thanks @hugopeixoto) - * Only run the at_exit behaviors if the current PID matches the PID that called SimpleCov.start. See #377(https://github.com/colszowka/simplecov/pull/377) (thanks @coderanger) + * Fix order dependencies in unit tests. See #376(https://github.com/simplecov-ruby/simplecov/pull/376) (thanks @hugopeixoto) + * Only run the at_exit behaviors if the current PID matches the PID that called SimpleCov.start. See #377(https://github.com/simplecov-ruby/simplecov/pull/377) (thanks @coderanger) -0.9.2, 2015-02-18 (changes(https://github.com/colszowka/simplecov/compare/v0.9.1...v0.9.2)) +0.9.2, 2015-02-18 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.9.1...v0.9.2)) ================= This is a minor bugfix release for simplecov-html, released as `0.9.0`. Due to the tight version constraint in the gemspec a new release of simplecov had to be shipped to allow using simplecov-html `~> 0.9.0`. - * The browser back / forward button should now work again. See #36(https://github.com/colszowka/simplecov-html/pull/36) and - #35(https://github.com/colszowka/simplecov-html/pull/35). Thanks @whatasunnyday and @justinsteele for submitting PRs to fix this. - * Fix "warning: possibly useless use of a variable in void context" See #31(https://github.com/colszowka/simplecov-html/pull/31). Thanks @cbandy - * Always use binary file format. See #32(https://github.com/colszowka/simplecov-html/pull/32). Thanks @andy128k - * Avoid slow file output with JRuby/Windows. See #16(https://github.com/colszowka/simplecov-html/pull/16). Thanks @pschambacher + * The browser back / forward button should now work again. See #36(https://github.com/simplecov-ruby/simplecov-html/pull/36) and + #35(https://github.com/simplecov-ruby/simplecov-html/pull/35). Thanks @whatasunnyday and @justinsteele for submitting PRs to fix this. + * Fix "warning: possibly useless use of a variable in void context" See #31(https://github.com/simplecov-ruby/simplecov-html/pull/31). Thanks @cbandy + * Always use binary file format. See #32(https://github.com/simplecov-ruby/simplecov-html/pull/32). Thanks @andy128k + * Avoid slow file output with JRuby/Windows. See #16(https://github.com/simplecov-ruby/simplecov-html/pull/16). Thanks @pschambacher Other than the release includes a bunch of mostly documentation improvements: - * Update Rails path for Rails 4+. See #336(https://github.com/colszowka/simplecov/pull/336). Thanks @yazinsai - * Encourage use of .simplecov to avoid lost files. See #338(https://github.com/colszowka/simplecov/pull/338). thanks @dankohn - * Specified in the gemspec that simplecov needs ruby 1.8.7. See #343(https://github.com/colszowka/simplecov/pull/343). thanks @iainbeeston - * Fix mispointed link in CHANGELOG.md. See #353(https://github.com/colszowka/simplecov/pull/353). Thanks @dleve123 - * Improve command name docs. See #356(https://github.com/colszowka/simplecov/pull/356). Thanks @gtd + * Update Rails path for Rails 4+. See #336(https://github.com/simplecov-ruby/simplecov/pull/336). Thanks @yazinsai + * Encourage use of .simplecov to avoid lost files. See #338(https://github.com/simplecov-ruby/simplecov/pull/338). thanks @dankohn + * Specified in the gemspec that simplecov needs ruby 1.8.7. See #343(https://github.com/simplecov-ruby/simplecov/pull/343). thanks @iainbeeston + * Fix mispointed link in CHANGELOG.md. See #353(https://github.com/simplecov-ruby/simplecov/pull/353). Thanks @dleve123 + * Improve command name docs. See #356(https://github.com/simplecov-ruby/simplecov/pull/356). Thanks @gtd -0.9.1, 2014-09-21 (changes(https://github.com/colszowka/simplecov/compare/v0.9.0...v0.9.1)) +0.9.1, 2014-09-21 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.9.0...v0.9.1)) ================= ## Bugfixes * In 0.9.0, we introduced a regression that made SimpleCov no-op mode fail on Ruby 1.8, while dropping 1.8 support altogether is announced only for v1.0. This has been fixed. - See #333(https://github.com/colszowka/simplecov/issues/333) (thanks (@sferik) + See #333(https://github.com/simplecov-ruby/simplecov/issues/333) (thanks (@sferik) -0.9.0, 2014-07-17 (changes(https://github.com/colszowka/simplecov/compare/v0.8.2...v0.9.0)) +0.9.0, 2014-07-17 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.8.2...v0.9.0)) ================= **A warm welcome and big thank you to the new contributors @xaviershay(https://github.com/xaviershay), @sferik(https://github.com/sferik) and especially @bf4(https://github.com/bf4) for tackling a whole lot of issues and pull requests for this release!** @@ -119,54 +354,54 @@ ## Enhancements * New interface to specify multiple formatters. - See #317(https://github.com/colszowka/simplecov/pull/317) (thanks @sferik) + See #317(https://github.com/simplecov-ruby/simplecov/pull/317) (thanks @sferik) * Document in the README how to exclude code from coverage reports, and that the feature shouldn't be abused for skipping untested private code. - See #304(https://github.com/colszowka/simplecov/issues/304) + See #304(https://github.com/simplecov-ruby/simplecov/issues/304) * Clarify Ruby version support. - See #279(https://github.com/colszowka/simplecov/pull/279) (thanks @deivid-rodriguez) + See #279(https://github.com/simplecov-ruby/simplecov/pull/279) (thanks @deivid-rodriguez) ## Bugfixes * Ensure calculations return Floats, not Fixnum or Rational. Fixes segfaults with mathn. - See #245(https://github.com/colszowka/simplecov/pull/245) (thanks to @bf4) + See #245(https://github.com/simplecov-ruby/simplecov/pull/245) (thanks to @bf4) * Using `Kernel.exit` instead of exit to avoid uncaught throw :IRB_EXIT when exiting irb sessions. - See #287(https://github.com/colszowka/simplecov/pull/287) (thanks @wless1) - See #285(https://github.com/colszowka/simplecov/issues/285) + See #287(https://github.com/simplecov-ruby/simplecov/pull/287) (thanks @wless1) + See #285(https://github.com/simplecov-ruby/simplecov/issues/285) * Does not look for .simplecov in ~/ when $HOME is not set. - See #311(https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert) + See #311(https://github.com/simplecov-ruby/simplecov/pull/311) (thanks @lasseebert) * Exit with code only if it's Numeric > 0. - See #302(https://github.com/colszowka/simplecov/pull/302) (thanks @hajder) + See #302(https://github.com/simplecov-ruby/simplecov/pull/302) (thanks @hajder) * Make default filter case insensitive. - See #280(https://github.com/colszowka/simplecov/pull/280) (thanks @ryanatball) + See #280(https://github.com/simplecov-ruby/simplecov/pull/280) (thanks @ryanatball) * Improve regexp that matches functional tests. - See #276(https://github.com/colszowka/simplecov/pull/276) (thanks @sferik) - * Fix TravisCI #272(https://github.com/colszowka/simplecov/pull/272) #278(https://github.com/colszowka/simplecov/pull/278), #302(https://github.com/colszowka/simplecov/pull/302) + See #276(https://github.com/simplecov-ruby/simplecov/pull/276) (thanks @sferik) + * Fix TravisCI #272(https://github.com/simplecov-ruby/simplecov/pull/272) #278(https://github.com/simplecov-ruby/simplecov/pull/278), #302(https://github.com/simplecov-ruby/simplecov/pull/302) * Fix global config load. - See #311(https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert) + See #311(https://github.com/simplecov-ruby/simplecov/pull/311) (thanks @lasseebert) -v0.8.2, 2013-11-20 (changes(https://github.com/colszowka/simplecov/compare/v0.8.1...v0.8.2)) +v0.8.2, 2013-11-20 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.8.1...v0.8.2)) ================== ## Bugfixes - * Replaced the locking behaviour via lockfile gem(https://github.com/colszowka/simplecov/pull/185) with + * Replaced the locking behaviour via lockfile gem(https://github.com/simplecov-ruby/simplecov/pull/185) with plain Ruby explicit file locking when merging results. This should make simplecov merging to behave well on Windows again. - See #258(https://github.com/colszowka/simplecov/issues/258) and - #223(https://github.com/colszowka/simplecov/pull/223) (thanks to @tomykaira) + See #258(https://github.com/simplecov-ruby/simplecov/issues/258) and + #223(https://github.com/simplecov-ruby/simplecov/pull/223) (thanks to @tomykaira) -v0.8.1, 2013-11-10 (changes(https://github.com/colszowka/simplecov/compare/v0.8.0...v0.8.1)) +v0.8.1, 2013-11-10 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.8.0...v0.8.1)) ================== ## Bugfixes * Fixed a regression introduced in 0.8.0 - the Forwardable STDLIB module is now required explicitly. - See #256(https://github.com/colszowka/simplecov/pull/256) (thanks to @kylev) + See #256(https://github.com/simplecov-ruby/simplecov/pull/256) (thanks to @kylev) -v0.8.0, 2013-11-10 (changes(https://github.com/colszowka/simplecov/compare/v0.7.1...v0.8.0)) +v0.8.0, 2013-11-10 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.7.1...v0.8.0)) ================== **Note: Yanked the same day because of the regression that 0.8.1 fixes, see above** @@ -184,158 +419,158 @@ ## Features * Configuration blocks now have access to variables and methods outside of the block's scope. - See #238(https://github.com/colszowka/simplecov/pull/238) (thanks to @ms-tg) + See #238(https://github.com/simplecov-ruby/simplecov/pull/238) (thanks to @ms-tg) * You can now have a global `~/.simplecov` configuration file. - See #195(https://github.com/colszowka/simplecov/pull/195) (thanks to @spagalloco) + See #195(https://github.com/simplecov-ruby/simplecov/pull/195) (thanks to @spagalloco) * simplecov-html now uses the MIT-licensed colorbox plugin. Some adjustments when viewing source files, including retaining the currently open file on refresh have been added. - See simplecov-html #15(https://github.com/colszowka/simplecov-html/pull/15) (thanks to @chetan) + See simplecov-html #15(https://github.com/simplecov-ruby/simplecov-html/pull/15) (thanks to @chetan) * Adds support for Rails 4 command guessing, removes default group `vendor/plugins`. - See #181(https://github.com/colszowka/simplecov/pull/181) and - #203(https://github.com/colszowka/simplecov/pull/203) (thanks to @semanticart and @phallstrom) + See #181(https://github.com/simplecov-ruby/simplecov/pull/181) and + #203(https://github.com/simplecov-ruby/simplecov/pull/203) (thanks to @semanticart and @phallstrom) * You can now load simplecov without the default settings by doing `require 'simplecov/no_defaults'` or setting `ENV'SIMPLECOV_NO_DEFAULTS'`. Check `simplecov/defaults` to see what preconfigurations are getting - dropped by using this. See #209(https://github.com/colszowka/simplecov/pull/209) (thanks to @ileitch) + dropped by using this. See #209(https://github.com/simplecov-ruby/simplecov/pull/209) (thanks to @ileitch) * The result set merging now uses the `lockfile` gem to avoid race conditions. - See #185(https://github.com/colszowka/simplecov/pull/185) (thanks to @jshraibman-mdsol). + See #185(https://github.com/simplecov-ruby/simplecov/pull/185) (thanks to @jshraibman-mdsol). * Automatically detect the usage of parallel_tests and adjust the command name with the test env number accordingly, - See #64(https://github.com/colszowka/simplecov/issues/64) and - #185(https://github.com/colszowka/simplecov/pull/185) (thanks to @jshraibman-mdsol). + See #64(https://github.com/simplecov-ruby/simplecov/issues/64) and + #185(https://github.com/simplecov-ruby/simplecov/pull/185) (thanks to @jshraibman-mdsol). ## Enhancements * Rename adapters to "profiles" given that they are bundles of settings. The old adapter methods are deprecated, but remain available for now. - See #207(https://github.com/colszowka/simplecov/pull/207) (thanks to @mikerobe) + See #207(https://github.com/simplecov-ruby/simplecov/pull/207) (thanks to @mikerobe) * Tweaks to the automatic test suite naming. In particular, `rspec/features` should now be correctly attributed to RSpec, not Cucumber. - See #212(https://github.com/colszowka/simplecov/pull/212) (thanks to @ersatzryan and @betelgeuse) + See #212(https://github.com/simplecov-ruby/simplecov/pull/212) (thanks to @ersatzryan and @betelgeuse) * MiniTest should now be identified correctly by the command name guesser. - See #244(https://github.com/colszowka/simplecov/pull/244) (thanks to @envygeeks) + See #244(https://github.com/simplecov-ruby/simplecov/pull/244) (thanks to @envygeeks) * Makes SimpleCov resilient to inclusion of mathn library. - See #175(https://github.com/colszowka/simplecov/pull/175) and - #140(https://github.com/colszowka/simplecov/issues/140) (thanks to @scotje) + See #175(https://github.com/simplecov-ruby/simplecov/pull/175) and + #140(https://github.com/simplecov-ruby/simplecov/issues/140) (thanks to @scotje) * Allow coverage_dir to be an absolute path. - * See #190(https://github.com/colszowka/simplecov/pull/190) (thanks to @jshraibman-mdsol) + * See #190(https://github.com/simplecov-ruby/simplecov/pull/190) (thanks to @jshraibman-mdsol) * The internal cucumber test suite now uses Capybara 2. - See #206(https://github.com/colszowka/simplecov/pull/206) (thanks to @infertux) + See #206(https://github.com/simplecov-ruby/simplecov/pull/206) (thanks to @infertux) * Work-arounds for the Coverage library shipped in JRuby 1.6 to behave in line with MRI. - See #174(https://github.com/colszowka/simplecov/pull/174) (thanks to @grddev) + See #174(https://github.com/simplecov-ruby/simplecov/pull/174) (thanks to @grddev) * Fix warning: instance variable @exit_status not initialized. - See #242(https://github.com/colszowka/simplecov/pull/242) and - #213(https://github.com/colszowka/simplecov/pull/213) (thanks to @sferik and @infertux) + See #242(https://github.com/simplecov-ruby/simplecov/pull/242) and + #213(https://github.com/simplecov-ruby/simplecov/pull/213) (thanks to @sferik and @infertux) ## Bugfixes * Correct result calculations for people using :nocov: tags. - See #215(https://github.com/colszowka/simplecov/pull/215) (thanks to @aokolish) + See #215(https://github.com/simplecov-ruby/simplecov/pull/215) (thanks to @aokolish) * Average hits per line for groups of files is now computed correctly. - See #192(http://github.com/colszowka/simplecov/pull/192) and - #179(http://github.com/colszowka/simplecov/issues/179) (thanks to @graysonwright) - * Compatability with BINARY internal encoding. - See #194(https://github.com/colszowka/simplecov/pull/194) and - #127(https://github.com/colszowka/simplecov/issues/127) (thanks to @justfalter) + See #192(http://github.com/simplecov-ruby/simplecov/pull/192) and + #179(http://github.com/simplecov-ruby/simplecov/issues/179) (thanks to @graysonwright) + * Compatibility with BINARY internal encoding. + See #194(https://github.com/simplecov-ruby/simplecov/pull/194) and + #127(https://github.com/simplecov-ruby/simplecov/issues/127) (thanks to @justfalter) * Special characters in `SimpleCov.root` are now correctly escaped before being used as a RegExp. - See #204(https://github.com/colszowka/simplecov/issues/204) and - #237(https://github.com/colszowka/simplecov/pull/237) (thanks to @rli9) + See #204(https://github.com/simplecov-ruby/simplecov/issues/204) and + #237(https://github.com/simplecov-ruby/simplecov/pull/237) (thanks to @rli9) -v0.7.1, 2012-10-12 (changes(https://github.com/colszowka/simplecov/compare/v0.7.0...v0.7.1)) +v0.7.1, 2012-10-12 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.7.0...v0.7.1)) ================== * BUGFIX The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then - trying to use it as a normal user (see https://github.com/colszowka/simplecov/issues/171, thanks @envygeeks + trying to use it as a normal user (see https://github.com/simplecov-ruby/simplecov/issues/171, thanks @envygeeks for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging to avoid this issue in the future. -v0.7.0, 2012-10-10 (changes(https://github.com/colszowka/simplecov/compare/v0.6.4...v0.7.0)) +v0.7.0, 2012-10-10 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.6.4...v0.7.0)) ================== * FEATURE The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows any coverage drops between test runs. - See https://github.com/colszowka/simplecov/pull/151, https://github.com/colszowka/simplecov/issues/11, - https://github.com/colszowka/simplecov/issues/90, and https://github.com/colszowka/simplecov/issues/96 (thanks to @infertux) + See https://github.com/simplecov-ruby/simplecov/pull/151, https://github.com/simplecov-ruby/simplecov/issues/11, + https://github.com/simplecov-ruby/simplecov/issues/90, and https://github.com/simplecov-ruby/simplecov/issues/96 (thanks to @infertux) * FEATURE SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at the same time without the need to write custom wrapper code. - See https://github.com/colszowka/simplecov/pull/158 (thanks to @nikitug) + See https://github.com/simplecov-ruby/simplecov/pull/158 (thanks to @nikitug) * BUGFIX The usage of digits, hyphens and underscores in group names could lead to broken tab navigation - in the default simplecov-html reports. See https://github.com/colszowka/simplecov-html/pull/14 (thanks to @ebelgarts) - * REFACTORING A few more ruby warnings removed. See https://github.com/colszowka/simplecov/issues/106 and - https://github.com/colszowka/simplecov/pull/139. (thanks to @lukejahnke) - * A Pledgie button(https://github.com/colszowka/simplecov/commit/63cfa99f8658fa5cc66a38c83b3195fdf71b9e93) for those that + in the default simplecov-html reports. See https://github.com/simplecov-ruby/simplecov-html/pull/14 (thanks to @ebelgarts) + * REFACTORING A few more ruby warnings removed. See https://github.com/simplecov-ruby/simplecov/issues/106 and + https://github.com/simplecov-ruby/simplecov/pull/139. (thanks to @lukejahnke) + * A Pledgie button(https://github.com/simplecov-ruby/simplecov/commit/63cfa99f8658fa5cc66a38c83b3195fdf71b9e93) for those that feel generous :) * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those! -v0.6.4, 2012-05-10 (changes(https://github.com/colszowka/simplecov/compare/v0.6.3...v0.6.4)) +v0.6.4, 2012-05-10 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.6.3...v0.6.4)) ================== * BUGFIX Encoding issues with ISO-8859-encoded source files fixed. - See https://github.com/colszowka/simplecov/pull/117. (thanks to @Deradon) + See https://github.com/simplecov-ruby/simplecov/pull/117. (thanks to @Deradon) * BUGFIX Ensure ZeroDivisionErrors won't occur when calculating the coverage result, which previously - could happen in certain cases. See https://github.com/colszowka/simplecov/pull/128. (thanks to @japgolly) + could happen in certain cases. See https://github.com/simplecov-ruby/simplecov/pull/128. (thanks to @japgolly) * REFACTORING Changed a couple instance variable lookups so SimpleCov does not cause a lot of warnings when - running ruby at a higher warning level. See https://github.com/colszowka/simplecov/issues/106 and - https://github.com/colszowka/simplecov/pull/119. (thanks to @mvz and @gioele) + running ruby at a higher warning level. See https://github.com/simplecov-ruby/simplecov/issues/106 and + https://github.com/simplecov-ruby/simplecov/pull/119. (thanks to @mvz and @gioele) -v0.6.3, 2012-05-10 (changes(https://github.com/colszowka/simplecov/compare/v0.6.2...v0.6.3)) +v0.6.3, 2012-05-10 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.6.2...v0.6.3)) ================== * BUGFIX Modified the API-changes for newer multi_json versions introduced with #122 and v0.6.2 so they are backwards-compatible with older multi_json gems in order to avoid simplecov polluting the multi_json minimum version requirement for entire applications. - See https://github.com/colszowka/simplecov/issues/132 + See https://github.com/simplecov-ruby/simplecov/issues/132 * Added appraisal gem to the test setup in order to run the test suite against both 1.0 and 1.3 multi_json gems and ensure the above actually works :) -v0.6.2, 2012-04-20 (changes(https://github.com/colszowka/simplecov/compare/v0.6.1...v0.6.2)) +v0.6.2, 2012-04-20 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.6.1...v0.6.2)) ================== * Updated to latest version of MultiJSON and its new API (thanks to @sferik and @ronen). - See https://github.com/colszowka/simplecov/pull/122 + See https://github.com/simplecov-ruby/simplecov/pull/122 -v0.6.1, 2012-02-24 (changes(https://github.com/colszowka/simplecov/compare/v0.6.0...v0.6.1)) +v0.6.1, 2012-02-24 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.6.0...v0.6.1)) ================== * BUGFIX Don't force-load Railtie on Rails < 3. Fixes regression introduced with - #83. See https://github.com/colszowka/simplecov/issues/113 + #83. See https://github.com/simplecov-ruby/simplecov/issues/113 -v0.6.0, 2012-02-22 (changes(https://github.com/colszowka/simplecov/compare/v0.5.4...v0.6.0)) +v0.6.0, 2012-02-22 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.5.4...v0.6.0)) ================== * FEATURE Auto-magic `rake simplecov` task for rails - (see https://github.com/colszowka/simplecov/pull/83, thanks @sunaku) + (see https://github.com/simplecov-ruby/simplecov/pull/83, thanks @sunaku) * BUGFIX Treat source files as UTF-8 to avoid encoding errors - (see https://github.com/colszowka/simplecov/pull/103, thanks @joeyates) + (see https://github.com/simplecov-ruby/simplecov/pull/103, thanks @joeyates) * BUGFIX Store the invoking terminal command right after loading so they are safe from other libraries tampering with ARGV. Among other makes automatic Rails test suite splitting (Unit/Functional/Integration) work with recent rake versions again - (see https://github.com/colszowka/simplecov/issues/110) + (see https://github.com/simplecov-ruby/simplecov/issues/110) * FEATURE If guessing command name from the terminal command fails, try guessing from defined constants - (see https://github.com/colszowka/simplecov/commit/37afca54ef503c33d888e910f950b3b943cb9a6c) + (see https://github.com/simplecov-ruby/simplecov/commit/37afca54ef503c33d888e910f950b3b943cb9a6c) * Some refactorings and cleanups as usual. Please refer to the github compare view for a full - list of changes: https://github.com/colszowka/simplecov/compare/v0.5.4...v0.6.0 + list of changes: https://github.com/simplecov-ruby/simplecov/compare/v0.5.4...v0.6.0 -v0.5.4, 2011-10-12 (changes(https://github.com/colszowka/simplecov/compare/v0.5.3...v0.5.4)) +v0.5.4, 2011-10-12 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.5.3...v0.5.4)) ================== * Do not give exit code 0 when there are exceptions prior to tests - (see https://github.com/colszowka/simplecov/issues/41, thanks @nbogie) + (see https://github.com/simplecov-ruby/simplecov/issues/41, thanks @nbogie) * The API for building custom filter classes is now more obvious, using #matches? instead of #passes? too. - (see https://github.com/colszowka/simplecov/issues/85, thanks @robinroestenburg) + (see https://github.com/simplecov-ruby/simplecov/issues/85, thanks @robinroestenburg) * Mailers are now part of the Rails adapter as their own group (see - https://github.com/colszowka/simplecov/issues/79, thanks @geetarista) + https://github.com/simplecov-ruby/simplecov/issues/79, thanks @geetarista) * Removed fix for JRuby 1.6 RC1 float bug because it's been fixed - (see https://github.com/colszowka/simplecov/issues/86) + (see https://github.com/simplecov-ruby/simplecov/issues/86) * Readme formatted in Markdown :) -v0.5.3, 2011-09-13 (changes(https://github.com/colszowka/simplecov/compare/v0.5.2...v0.5.3)) +v0.5.3, 2011-09-13 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.5.2...v0.5.3)) ================== * Fix for encoding issues that came from the nocov processing mechanism - (see https://github.com/colszowka/simplecov/issues/71) + (see https://github.com/simplecov-ruby/simplecov/issues/71) * :nocov: lines are now actually being reflected in the HTML report and are marked in yellow. * The Favicon in the HTML report is now determined by the overall coverage and will have the color @@ -346,24 +581,24 @@ * Refactored nocov processing and made it configurable using SimpleCov.ncov_token (or it's alias SimpleCov.skip_token) -v0.5.2, 2011-09-12 (changes(https://github.com/colszowka/simplecov/compare/v0.5.1...v0.5.2)) +v0.5.2, 2011-09-12 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.5.1...v0.5.2)) ================== * Another fix for a bug in JSON processing introduced with MultiJSON in 0.5.1 - (see https://github.com/colszowka/simplecov/pull/75, thanks @sferik) + (see https://github.com/simplecov-ruby/simplecov/pull/75, thanks @sferik) -v0.5.1, 2011-09-12 (changes(https://github.com/colszowka/simplecov/compare/v0.5.0...v0.5.1)) +v0.5.1, 2011-09-12 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.5.0...v0.5.1)) ================== **Note: Yanked 2011-09-12 because the MultiJSON-patch had a crucial bug** - * Fix for invalid gemspec dependency string (see https://github.com/colszowka/simplecov/pull/70, + * Fix for invalid gemspec dependency string (see https://github.com/simplecov-ruby/simplecov/pull/70, http://blog.rubygems.org/2011/08/31/shaving-the-yaml-yacc.html, thanks @jspradlin) * Added JSON in the form of the multi_json gem as dependency for those cases when built-in JSON - is unavailable (see https://github.com/colszowka/simplecov/issues/72 - and https://github.com/colszowka/simplecov/pull/74, thanks @sferik) + is unavailable (see https://github.com/simplecov-ruby/simplecov/issues/72 + and https://github.com/simplecov-ruby/simplecov/pull/74, thanks @sferik) -v0.5.0, 2011-09-09 (changes(https://github.com/colszowka/simplecov/compare/v0.4.2...v0.5.4)) +v0.5.0, 2011-09-09 (changes(https://github.com/simplecov-ruby/simplecov/compare/v0.4.2...v0.5.4)) ================== **Note: Yanked 2011-09-09 because of trouble with the gemspec.**
View file
_service:tar_scm:simplecov-0.19.1.gem/data/CODE_OF_CONDUCT.md
Added
@@ -0,0 +1,76 @@ +# SimpleCov Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at simplecov.team@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenanthomepage, version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +homepage: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq
View file
_service:tar_scm:simplecov-0.13.0.gem/data/CONTRIBUTING.md -> _service:tar_scm:simplecov-0.19.1.gem/data/CONTRIBUTING.md
Changed
@@ -1,20 +1,22 @@ ## Reporting Issues -You can report issues at https://github.com/colszowka/simplecov/issues +You can report issues at https://github.com/simplecov-ruby/simplecov/issues -Search existing issues for your problem, chances are someone else already reported it. +Before you go ahead please search existing issues for your problem, chances are someone else already reported it. +To make sure that we can help you quickly please include and check the following information: + + * Include how you run your tests and which testing framework or frameworks you are running. + - please ensure you are requiring and starting SimpleCov before requiring any application code. + - If running via rake, please ensure you are requiring SimpleCov at the top of your Rakefile + For example, if running via RSpec, this would be at the top of your spec_helper. + - Have you tried using a `.simplecov` file(https://github.com/simplecov-ruby/simplecov#using-simplecov-for-centralized-config)? * Include the SimpleCov version you are running in your report. * If you are not running the latest version (please check), and you cannot update it, please specify in your report why you can't update to the latest version. * Include your `ruby -e "puts RUBY_DESCRIPTION"`. * Please also specify the gem versions of Rails (if applicable). * Include any other coverage gems you may be using and their versions. - * Include how you run your tests and which testing framework or frameworks you are running. - - If running via rake, please ensure you are requiring SimpleCov at the top of your Rakefile - - Otherwise, please ensure you are requiring and starting SimpleCov before requiring any application code. - For example, if running via RSpec, this would be at the top of your spec_helper. - - Have you tried using a `.simplecov` file(https://github.com/colszowka/simplecov#using-simplecov-for-centralized-config)? Include as much sample code as you can to help us reproduce the issue. (Inline, repo link, or gist, are fine. A failing test would help the most.) @@ -26,7 +28,7 @@ To fetch & test the library for development, do: - $ git clone https://github.com/colszowka/simplecov.git + $ git clone https://github.com/simplecov-ruby/simplecov.git $ cd simplecov $ bundle $ bundle exec rake @@ -37,12 +39,13 @@ * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * **Bonus Points** go out to anyone who also updates `CHANGELOG.md` :) - * Send me a pull request on Github. + * Send me a pull request on GitHub. ## Running Individual Tests -This project uses Test::Unit. Individual tests can be run like this: +This project uses RSpec and Cucumber. Individual tests can be run like this: ```bash -ruby -I test path/to/test.rb +bundle exec rspec path/to/test.rb +bundle exec cucumber path/to/test.feature ```
View file
_service:tar_scm:simplecov-0.19.1.gem/data/ISSUE_TEMPLATE.md
Added
@@ -0,0 +1,23 @@ +Howdy! Thanks for reporting an issue <3 + +Before you go ahead please search existing issues for your problem, chances are someone else already reported it. + +To make sure that we can help you quickly please include and check the following information: + + * Include how you run your tests and which testing framework or frameworks you are running. + - please ensure you are requiring and starting SimpleCov before requiring any application code. + - If running via rake, please ensure you are requiring SimpleCov at the top of your Rakefile + For example, if running via RSpec, this would be at the top of your spec_helper. + - Have you tried using a `.simplecov` file(https://github.com/simplecov-ruby/simplecov#using-simplecov-for-centralized-config)? + * Include the SimpleCov version you are running in your report. + * If you are not running the latest version (please check), and you cannot update it, + please specify in your report why you can't update to the latest version. + * Include your `ruby -e "puts RUBY_DESCRIPTION"`. + * Please also specify the gem versions of Rails (if applicable). + * Include any other coverage gems you may be using and their versions. + +Include as much sample code as you can to help us reproduce the issue. (Inline, repo link, or gist, are fine. A failing test would help the most.) + +This is extremely important for narrowing down the cause of your problem. + +Thanks!
View file
_service:tar_scm:simplecov-0.19.1.gem/data/LICENSE
Added
@@ -0,0 +1,20 @@ +Copyright (c) 2010-2017 Christoph Olszowka + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View file
_service:tar_scm:simplecov-0.13.0.gem/data/README.md -> _service:tar_scm:simplecov-0.19.1.gem/data/README.md
Changed
@@ -1,5 +1,6 @@ -SimpleCov !Build Status(https://travis-ci.org/colszowka/simplecov.svg)Continuous Integration !Dependency Status(https://gemnasium.com/colszowka/simplecov.svg)Dependencies !Code Climate(https://codeclimate.com/github/colszowka/simplecov.svg)(https://codeclimate.com/github/colszowka/simplecov) !Inline docs(http://inch-ci.org/github/colszowka/simplecov.svg)(http://inch-ci.org/github/colszowka/simplecov) +SimpleCov !Gem Version(https://badge.fury.io/rb/simplecov.svg)(https://badge.fury.io/rb/simplecov) !Build Status(https://github.com/simplecov-ruby/simplecov/workflows/stable/badge.svg?branch=main)Continuous Integration !Maintainability(https://api.codeclimate.com/v1/badges/c071d197d61953a7e482/maintainability)(https://codeclimate.com/github/simplecov-ruby/simplecov/maintainability) !Inline docs(http://inch-ci.org/github/simplecov-ruby/simplecov.svg?branch=main)(http://inch-ci.org/github/simplecov-ruby/simplecov) ========= + **Code coverage for Ruby** * Source Code @@ -8,49 +9,52 @@ * Rubygem * Continuous Integration -Coverage: http://www.ruby-doc.org/stdlib-2.1.0/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby's Coverage library" -Source Code: https://github.com/colszowka/simplecov "Source Code @ GitHub" +Coverage: https://ruby-doc.org/stdlib/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby's Coverage library" +Source Code: https://github.com/simplecov-ruby/simplecov "Source Code @ GitHub" API documentation: http://rubydoc.info/gems/simplecov/frames "RDoc API Documentation at Rubydoc.info" Configuration: http://rubydoc.info/gems/simplecov/SimpleCov/Configuration "Configuration options API documentation" -Changelog: https://github.com/colszowka/simplecov/blob/master/CHANGELOG.md "Project Changelog" +Changelog: https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md "Project Changelog" Rubygem: http://rubygems.org/gems/simplecov "SimpleCov @ rubygems.org" -Continuous Integration: http://travis-ci.org/colszowka/simplecov "SimpleCov is built around the clock by travis-ci.org" -Dependencies: https://gemnasium.com/colszowka/simplecov "SimpleCov dependencies on Gemnasium" -simplecov-html: https://github.com/colszowka/simplecov-html "SimpleCov HTML Formatter Source Code @ GitHub" +Continuous Integration: https://github.com/simplecov-ruby/simplecov/actions?query=workflow%3Astable "SimpleCov is built around the clock by github.com" +Dependencies: https://gemnasium.com/simplecov-ruby/simplecov "SimpleCov dependencies on Gemnasium" +simplecov-html: https://github.com/simplecov-ruby/simplecov-html "SimpleCov HTML Formatter Source Code @ GitHub" SimpleCov is a code coverage analysis tool for Ruby. It uses Ruby's built-in CoverageCoverage library to gather code coverage data, but makes processing its results much easier by providing a clean API to filter, group, merge, format, and display those results, giving you a complete code coverage suite that can be set up with just a couple lines of code. +SimpleCov/Coverage track covered ruby code, gathering coverage for common templating solutions like erb, slim and haml is not supported. In most cases, you'll want overall coverage results for your projects, including all types of tests, Cucumber features, etc. SimpleCov automatically takes care of this by caching and merging results when generating reports, so your report actually includes coverage across your test suites and thereby gives you a better picture of blank spots. -The official formatter of SimpleCov is packaged as a separate gem called simplecov-html, but will be installed and configured -automatically when you launch SimpleCov. If you're curious, you can find it on Github, toosimplecov-html. +The official formatter of SimpleCov is packaged as a separate gem called simplecov-html, but will be installed and +configured automatically when you launch SimpleCov. If you're curious, you can find it on GitHub, toosimplecov-html. ## Contact *Code and Bug Reports* -* Issue Tracker(https://github.com/colszowka/simplecov/issues) -* See CONTRIBUTING(https://github.com/colszowka/simplecov/blob/master/CONTRIBUTING.md) for how to contribute along with some common problems to check out before creating an issue. +* Issue Tracker(https://github.com/simplecov-ruby/simplecov/issues) +* See CONTRIBUTING(https://github.com/simplecov-ruby/simplecov/blob/main/CONTRIBUTING.md) for how to contribute along +with some common problems to check out before creating an issue. *Questions, Problems, Suggestions, etc.* -* Mailing List: https://groups.google.com/forum/#!forum/simplecov "Open mailing list for discussion and announcements on Google Groups" +* Mailing List(https://groups.google.com/forum/#!forum/simplecov) "Open mailing list for discussion and announcements +on Google Groups" Getting started --------------- 1. Add SimpleCov to your `Gemfile` and `bundle install`: ```ruby - gem 'simplecov', :require => false, :group => :test + gem 'simplecov', require: false, group: :test ``` 2. Load and launch SimpleCov **at the very top** of your `test/test_helper.rb` - (*or `spec_helper.rb`, cucumber `env.rb`, or whatever your preferred test + (*or `spec_helper.rb`, `rails_helper`, cucumber `env.rb`, or whatever your preferred test framework uses*): ```ruby @@ -66,11 +70,12 @@ code is required!** SimpleCov must be running in the process that you want the code coverage - analysis to happen on. When testing a server process (i.e. a JSON API - endpoint) via a separate test process (i.e. when using Selenium) where you + analysis to happen on. When testing a server process (e.g. a JSON API + endpoint) via a separate test process (e.g. when using Selenium) where you want to see all code executed by the `rails server`, and not just code executed in your actual test files, you'll want to add something like this - to the top of `script/rails` (or `bin/rails` for Rails 4): + to the top of `bin/rails`, but below the "shebang" line (`#! /usr/bin/env + ruby`): ```ruby if ENV'RAILS_ENV' == 'test' @@ -79,23 +84,42 @@ puts "required simplecov" end ``` -3. Run your tests, open up `coverage/index.html` in your browser and check out - what you've missed so far. -4. Add the following to your `.gitignore` file to ensure that coverage results + +3. Run your full test suite to see the percent coverage that your application has. +4. After running your tests, open `coverage/index.html` in the browser of your choice. For example, in a Mac Terminal, + run the following command from your application's root directory: + + ``` + open coverage/index.html + ``` + in a debian/ubuntu Terminal, + + ``` + xdg-open coverage/index.html + ``` + + **Note:** This guide(https://dwheeler.com/essays/open-files-urls.html) can help if you're unsure which command your particular + operating system requires. + +5. Add the following to your `.gitignore` file to ensure that coverage results are not tracked by Git (optional): - ``` - coverage - ``` + ``` + echo "coverage" >> .gitignore + ``` + Or if you use Windows: + ``` + echo coverage >> .gitignore + ``` - If you're making a Rails application, SimpleCov comes with built-in configurations (see below for information on profiles) - that will get you started with groups for your Controllers, Views, Models and Helpers. To use it, the first two lines of - your test_helper should be like this: + If you're making a Rails application, SimpleCov comes with built-in configurations (see below for information on + profiles) that will get you started with groups for your Controllers, Models and Helpers. To use it, the + first two lines of your test_helper should be like this: - ```ruby - require 'simplecov' - SimpleCov.start 'rails' - ``` + ```ruby + require 'simplecov' + SimpleCov.start 'rails' + ``` ## Example output @@ -121,8 +145,9 @@ SimpleCov.start 'rails' ``` -You could even track what kind of code your UI testers are touching if you want to go overboard with things. SimpleCov does not -care what kind of framework it is running in; it just looks at what code is being executed and generates a report about it. +You could even track what kind of code your UI testers are touching if you want to go overboard with things. SimpleCov +does not care what kind of framework it is running in; it just looks at what code is being executed and generates a +report about it. ### Notes on specific frameworks and test utilities @@ -142,8 +167,19 @@ race conditions occur when results are merged. </td> <td> - <a href="https://github.com/colszowka/simplecov/issues/64">#64</a> & - <a href="https://github.com/colszowka/simplecov/pull/185">#185</a> + <a href="https://github.com/simplecov-ruby/simplecov/issues/64">#64</a> & + <a href="https://github.com/simplecov-ruby/simplecov/pull/185">#185</a> + </td> + </tr> + <tr> + <th> + knapsack_pro + </th> + <td> + To make SimpleCov work with Knapsack Pro Queue Mode to split tests in parallel on CI jobs you need to provide CI node index number to the <code>SimpleCov.command_name</code> in <code>KnapsackPro::Hooks::Queue.before_queue</code> hook. + </td> + <td> + <a href="https://knapsackpro.com/faq/question/how-to-use-simplecov-in-queue-mode">Tip</a> </td> </tr> <tr> @@ -156,7 +192,7 @@ to explicitly set the output root using `SimpleCov.root('foo/bar/baz')` </td> <td> - <a href="https://github.com/colszowka/simplecov/issues/95">#95</a> + <a href="https://github.com/simplecov-ruby/simplecov/issues/95">#95</a> </td> </tr> <tr> @@ -167,11 +203,11 @@ Because of how Spork works internally (using preforking), there used to be trouble when using SimpleCov with it, but that has apparently been resolved with a specific configuration strategy. See <a - href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">this</a> + href="https://github.com/simplecov-ruby/simplecov/issues/42#issuecomment-4440284">this</a> comment. </td> <td> - <a href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">#42</a> + <a href="https://github.com/simplecov-ruby/simplecov/issues/42#issuecomment-4440284">#42</a> </td> </tr> <tr> @@ -182,7 +218,7 @@ <a href="#want-to-use-spring-with-simplecov">See section below.</a> </td> <td> - <a href="https://github.com/colszowka/simplecov/issues/381">#381</a> + <a href="https://github.com/simplecov-ruby/simplecov/issues/381">#381</a> </td> </tr> <tr> @@ -195,7 +231,7 @@ (Dec 11th, 2011) should have this problem resolved. </td> <td> - <a href="https://github.com/colszowka/simplecov/issues/45">#45</a> & + <a href="https://github.com/simplecov-ruby/simplecov/issues/45">#45</a> & <a href="https://github.com/test-unit/test-unit/pull/12">test-unit/test-unit#12</a> </td> </tr> @@ -217,7 +253,8 @@ ```ruby SimpleCov.some_config_option 'foo' ``` -* If you do not want to start coverage immediately after launch or want to add additional configuration later on in a concise way, use: +* If you do not want to start coverage immediately after launch or want to add additional configuration later on in a + concise way, use: ```ruby SimpleCov.configure do @@ -229,11 +266,12 @@ ## Using .simplecov for centralized config -If you use SimpleCov to merge multiple test suite results (i.e. Test/Unit and Cucumber) into a single report, you'd normally have to -set up all your config options twice, once in `test_helper.rb` and once in `env.rb`. +If you use SimpleCov to merge multiple test suite results (e.g. Test/Unit and Cucumber) into a single report, you'd +normally have to set up all your config options twice, once in `test_helper.rb` and once in `env.rb`. -To avoid this, you can place a file called `.simplecov` in your project root. You can then just leave the `require 'simplecov'` in each -test setup helper and move the `SimpleCov.start` code with all your custom config options into `.simplecov`: +To avoid this, you can place a file called `.simplecov` in your project root. You can then just leave the +`require 'simplecov'` in each test setup helper (**at the top**) and move the `SimpleCov.start` code with all your +custom config options into `.simplecov`: ```ruby # test/test_helper.rb @@ -247,21 +285,74 @@ # any custom configs like groups and filters can be here at a central place end ``` -Using `.simplecov` rather than separately requiring SimpleCov multiple times is recommended if you are merging multiple test frameworks like Cucumber and RSpec that rely on each other, as invoking SimpleCov multiple times can cause coverage information to be lost. + +Using `.simplecov` rather than separately requiring SimpleCov multiple times is recommended if you are merging multiple +test frameworks like Cucumber and RSpec that rely on each other, as invoking SimpleCov multiple times can cause coverage +information to be lost. + +## Branch coverage (ruby "~> 2.5") +Add branch coverage measurement statistics to your results. Supported in CRuby versions 2.5+. + +```ruby +# or in configure or just SimpleCov.enable_coverage :branch +SimpleCov.start do + enable_coverage :branch +end +``` + +Branch coverage is a feature introduced in Ruby 2.5 concerning itself with whether a +particular branch of a condition had been executed. Line coverage on the other hand +is only interested in whether a line of code has been executed. + +This comes in handy for instance for one line conditionals: + +```ruby +number.odd? ? "odd" : "even" +``` + +In line coverage this line would always be marked as executed but you'd never know if both +conditions were met. Guard clauses have a similar story: + +```ruby +return if number.odd? + +# more code +``` + +If all the code in that method was covered you'd never know if the guard clause was ever +triggered! With line coverage as just evaluating the condition marks it as covered. + +In the HTML report the lines of code will be annotated like `branch_type: hit_count`: + +* `then: 2` - the then branch (of an `if`) was executed twice +* `else: 0` - the else branch (of an `if` or `case`) was never executed + +Not that even if you don't declare an `else` branch it will still show up in the coverage +reports meaning that the condition of the `if` was not hit or that no `when` of `case` +was hit during the test runs. + +**Is branch coverage strictly better?** No. Branch coverage really only concerns itself with +conditionals - meaning coverage of sequential code is of no interest to it. A file without +conditional logic will have no branch coverage data and SimpleCov will report 0 of 0 +branches covered as 100% (as everything that can be covered was covered). + +Hence, we recommend looking at both metrics together. Branch coverage might also be a good +overall metric to look at - while you might be missing only 10% of your lines that might +account for 50% of your branches for instance. ## Filters -Filters can be used to remove selected files from your coverage data. By default, a filter is applied that removes all files -OUTSIDE of your project's root directory - otherwise you'd end up with billions of coverage reports for source files in the -gems you are using. +Filters can be used to remove selected files from your coverage data. By default, a filter is applied that removes all +files OUTSIDE of your project's root directory - otherwise you'd end up with billions of coverage reports for source +files in the gems you are using. You can define your own to remove things like configuration files, tests or whatever you don't need in your coverage report. ### Defining custom filters -You can currently define a filter using either a String (that will then be Regexp-matched against each source file's path), -a block or by passing in your own Filter class. +You can currently define a filter using either a String or Regexp (that will then be Regexp-matched against each source +file's path), a block or by passing in your own Filter class. #### String filter @@ -273,6 +364,16 @@ This simple string filter will remove all files that match "/test/" in their path. +#### Regex filter + +```ruby +SimpleCov.start do + add_filter %r{^/test/} +end +``` + +This simple regex filter will remove all files that start with /test/ in their path. + #### Block filter ```ruby @@ -283,9 +384,10 @@ end ``` -Block filters receive a SimpleCov::SourceFile instance and expect your block to return either true (if the file is to be removed -from the result) or false (if the result should be kept). Please check out the RDoc for SimpleCov::SourceFile to learn about the -methods available to you. In the above example, the filter will remove all files that have less than 5 lines of code. +Block filters receive a SimpleCov::SourceFile instance and expect your block to return either true (if the file is to be +removed from the result) or false (if the result should be kept). Please check out the RDoc for SimpleCov::SourceFile to +learn about the methods available to you. In the above example, the filter will remove all files that have less than 5 +lines of code. #### Custom filter class @@ -299,9 +401,21 @@ SimpleCov.add_filter LineFilter.new(5) ``` -Defining your own filters is pretty easy: Just inherit from SimpleCov::Filter and define a method 'matches?(source_file)'. When running -the filter, a true return value from this method will result in the removal of the given source_file. The filter_argument method -is being set in the SimpleCov::Filter initialize method and thus is set to 5 in this example. +Defining your own filters is pretty easy: Just inherit from SimpleCov::Filter and define a method +'matches?(source_file)'. When running the filter, a true return value from this method will result in the removal of the +given source_file. The filter_argument method is being set in the SimpleCov::Filter initialize method and thus is set to +5 in this example. + +#### Array filter + +```ruby +SimpleCov.start do + proc = Proc.new { |source_file| false } + add_filter "string", /regex/, proc, LineFilter.new(5) +end +``` + +You can pass in an array containing any of the other filter types. #### Ignoring/skipping code @@ -315,17 +429,18 @@ # :nocov: ``` -The name of the token can be changed to your liking. Learn more about the nocov feature.nocov -nocov: https://github.com/colszowka/simplecov/blob/master/features/config_nocov_token.feature +The name of the token can be changed to your liking. Learn more about the nocov feature.( https://github.com/simplecov-ruby/simplecov/blob/main/features/config_nocov_token.feature) -**Note:** You shouldn't have to use the nocov token to skip private methods that are being included in your coverage. If you appropriately test the public interface of your classes and objects you should automatically get full coverage of your private methods. +**Note:** You shouldn't have to use the nocov token to skip private methods that are being included in your coverage. If +you appropriately test the public interface of your classes and objects you should automatically get full coverage of +your private methods. ## Default root filter and coverage for things outside of it By default, SimpleCov filters everything outside of the `SimpleCov.root` directory. However, sometimes you may want to include coverage reports for things you include as a gem, for example a Rails Engine. -Here's an example by @lsaffie(https://github.com/lsaffie) from #221(https://github.com/colszowka/simplecov/issues/221) +Here's an example by @lsaffie(https://github.com/lsaffie) from #221(https://github.com/simplecov-ruby/simplecov/issues/221) that shows how you can achieve just that: ```ruby @@ -341,8 +456,8 @@ You can separate your source files into groups. For example, in a Rails app, you'll want to have separate listings for Models, Controllers, Helpers, and Libs. Group definition works similarly to Filters (and also accepts custom -filter classes), but source files end up in a group when the filter passes (returns true), as opposed to filtering results, -which exclude files from results when the filter results in a true value. +filter classes), but source files end up in a group when the filter passes (returns true), as opposed to filtering +results, which exclude files from results when the filter results in a true value. Add your groups with: @@ -362,12 +477,11 @@ You normally want to have your coverage analyzed across ALL of your test suites, right? -Simplecov automatically caches coverage results in your (coverage_path)/.resultset.json. Those results will then -be automatically merged when generating the result, so when coverage is set up properly for Cucumber and your -unit / functional / integration tests, all of those test suites will be taken into account when building the -coverage report. - -There are two things to note here though: +Simplecov automatically caches coverage results in your +(coverage_path)/.resultset.json, and will merge or override those with +subsequent runs, depending on whether simplecov considers those subsequent runs +as different test suites or as the same test suite as the cached results. To +make this distinction, simplecov has the concept of "test suite names". ### Test suite names @@ -421,24 +535,143 @@ simplecov-html prints the used test suites in the footer of the generated coverage report. -### Timeout for merge -Of course, your cached coverage data is likely to become invalid at some point. Thus, result sets that are older than -`SimpleCov.merge_timeout` will not be used any more. By default, the timeout is 600 seconds (10 minutes), and you can -raise (or lower) it by specifying `SimpleCov.merge_timeout 3600` (1 hour), or, inside a configure/start block, with -just `merge_timeout 3600`. +### Merging test runs under the same execution environment -You can deactivate merging altogether with `SimpleCov.use_merging false`. +Test results are automatically merged with previous runs in the same execution +environment when generating the result, so when coverage is set up properly for +Cucumber and your unit / functional / integration tests, all of those test +suites will be taken into account when building the coverage report. + +#### Timeout for merge + +Of course, your cached coverage data is likely to become invalid at some point. Thus, when automatically merging +subsequent test runs, result sets that are older than `SimpleCov.merge_timeout` will not be used any more. By default, +the timeout is 600 seconds (10 minutes), and you can raise (or lower) it by specifying `SimpleCov.merge_timeout 3600` +(1 hour), or, inside a configure/start block, with just `merge_timeout 3600`. + +You can deactivate this automatic merging altogether with `SimpleCov.use_merging false`. + +### Merging test runs under different execution environments + +If your tests are done in parallel across multiple build machines, you can fetch them all and merge them into a single +result set using the `SimpleCov.collate` method. This can be added to a Rakefile or script file, having downloaded a set of +`.resultset.json` files from each parallel test run. + +```ruby +# lib/tasks/coverage_report.rake +namespace :coverage do + desc "Collates all result sets generated by the different test runners" + task :report do + require 'simplecov' + + SimpleCov.collate Dir"simplecov-resultset-*/.resultset.json" + end +end +``` + +`SimpleCov.collate` also takes an optional simplecov profile and an optional +block for configuration, just the same as `SimpleCov.start` or +`SimpleCov.configure`. This means you can configure a separate formatter for +the collated output. For instance, you can make the formatter in +`SimpleCov.start` the `SimpleCov::Formatter::SimpleFormatter`, and only use more +complex formatters in the final `SimpleCov.collate` run. + +```ruby +# spec/spec_helper.rb +require 'simplecov' + +SimpleCov.start 'rails' do + # Disambiguates individual test runs + command_name "Job #{ENV"TEST_ENV_NUMBER"}" if ENV"TEST_ENV_NUMBER" + + if ENV'CI' + formatter SimpleCov::Formatter::SimpleFormatter + else + formatter SimpleCov::Formatter::MultiFormatter.new( + SimpleCov::Formatter::SimpleFormatter, + SimpleCov::Formatter::HTMLFormatter + ) + end + + track_files "**/*.rb" +end +``` + +```ruby +# lib/tasks/coverage_report.rake +namespace :coverage do + task :report do + require 'simplecov' + + SimpleCov.collate Dir"simplecov-resultset-*/.resultset.json", 'rails' do + formatter SimpleCov::Formatter::MultiFormatter.new( + SimpleCov::Formatter::SimpleFormatter, + SimpleCov::Formatter::HTMLFormatter + ) + end + end +end +``` + +## Running simplecov against subprocesses + +`SimpleCov.enable_for_subprocesses` will allow SimpleCov to observe subprocesses starting using `Process.fork`. +This modifies ruby's core Process.fork method so that SimpleCov can see into it, appending `" (subprocess #{pid})"` +to the `SimpleCov.command_name`, with results that can be merged together using SimpleCov's merging feature. + +To configure this, use `.at_fork`. + +```ruby +SimpleCov.enable_for_subprocesses true +SimpleCov.at_fork do |pid| + # This needs a unique name so it won't be ovewritten + SimpleCov.command_name "#{SimpleCov.command_name} (subprocess: #{pid})" + # be quiet, the parent process will be in charge of output and checking coverage totals + SimpleCov.print_error_status = false + SimpleCov.formatter SimpleCov::Formatter::SimpleFormatter + SimpleCov.minimum_coverage 0 + # start + SimpleCov.start +end +``` + +NOTE: SimpleCov must have already been started before `Process.fork` was called. + +### Running simplecov against spawned subprocesses + +Perhaps you're testing a ruby script with `PTY.spawn` or `Open3.popen`, or `Process.spawn` or etc. +SimpleCov can cover this too. + +Add a .simplecov_spawn.rb file to your project root +```ruby +# .simplecov_spawn.rb +require 'simplecov' # this will also pick up whatever config is in .simplecov + # so ensure it just contains configuration, and doesn't call SimpleCov.start. +SimpleCov.command_name 'spawn' # As this is not for a test runner directly, script doesn't have a pre-defined base command_name +SimpleCov.at_fork.call(Process.pid) # Use the per-process setup described previously +SimpleCov.start # only now can we start. +``` +Then, instead of calling your script directly, like: +```ruby +PTY.spawn('my_script.rb') do # ... +``` +Use bin/ruby to require the new .simplecov_spawn file, then your script +```ruby +PTY.spawn('ruby -r./.simplecov_spawn my_script.rb') do # ... +``` ## Running coverage only on demand -The Ruby STDLIB Coverage library that SimpleCov builds upon is *very* fast (i.e. on a ~10 min Rails test suite, the speed drop was -only a couple seconds for me), and therefore it's SimpleCov's policy to just generate coverage every time you run your tests because -it doesn't do your test speed any harm and you're always equipped with the latest and greatest coverage results. +The Ruby STDLIB Coverage library that SimpleCov builds upon is *very* fast (on a ~10 min Rails test suite, the speed +drop was only a couple seconds for me), and therefore it's SimpleCov's policy to just generate coverage every time you +run your tests because it doesn't do your test speed any harm and you're always equipped with the latest and greatest +coverage results. Because of this, SimpleCov has no explicit built-in mechanism to run coverage only on demand. -However, you can still accomplish this very easily by introducing an ENV variable conditional into your SimpleCov setup block, like this: +However, you can still accomplish this very easily by introducing an ENV variable conditional into your SimpleCov setup +block, like this: ```ruby SimpleCov.start if ENV"COVERAGE" @@ -450,6 +683,21 @@ COVERAGE=true rake test ``` +## Errors and exit statuses + +To aid in debugging issues, if an error is raised, SimpleCov will print a message to `STDERR` +with the exit status of the error, like: + +``` +SimpleCov failed with exit 1 +``` + +This `STDERR` message can be disabled with: + +``` +SimpleCov.print_error_status = false +``` + ## Profiles By default, SimpleCov's only config assumption is that you only want coverage reports for files inside your project @@ -487,8 +735,8 @@ ### Custom profiles -You can load additional profiles with the SimpleCov.load_profile('xyz') method. This allows you to build upon an existing -profile and customize it so you can reuse it in unit tests and Cucumber features. For example: +You can load additional profiles with the SimpleCov.load_profile('xyz') method. This allows you to build upon an +existing profile and customize it so you can reuse it in unit tests and Cucumber features. For example: ```ruby # lib/simplecov_custom_profile.rb @@ -525,16 +773,23 @@ ```ruby SimpleCov.minimum_coverage 90 +# same as above (the default is to check line coverage) +SimpleCov.minimum_coverage line: 90 +# check for a minimum line coverage of 90% and minimum 80% branch coverage +SimpleCov.minimum_coverage line: 90, branch: 80 ``` ### Minimum coverage by file -You can define the minimum coverage by file percentage expected. SimpleCov will return non-zero if unmet. This is useful to help ensure coverage is relatively consistent, rather than being skewed by particularly good or bad areas of the code. +You can define the minimum coverage by file percentage expected. SimpleCov will return non-zero if unmet. This is useful +to help ensure coverage is relatively consistent, rather than being skewed by particularly good or bad areas of the code. ```ruby SimpleCov.minimum_coverage_by_file 80 ``` +(not yet supported for branch coverage) + ### Maximum coverage drop You can define the maximum coverage drop percentage at once. SimpleCov will return non-zero if exceeded. @@ -543,6 +798,8 @@ SimpleCov.maximum_coverage_drop 5 ``` +(not yet supported for branch coverage) + ### Refuse dropping coverage You can also entirely refuse dropping coverage between test runs: @@ -551,6 +808,8 @@ SimpleCov.refuse_coverage_drop ``` +(not yet supported for branch coverage) + ## Using your own formatter You can use your own formatter with: @@ -559,8 +818,8 @@ SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter ``` -When calling SimpleCov.result.format!, it will be invoked with SimpleCov::Formatter::YourFormatter.new.format(result), "result" -being an instance of SimpleCov::Result. Do whatever your wish with that! +When calling SimpleCov.result.format!, it will be invoked with SimpleCov::Formatter::YourFormatter.new.format(result), +"result" being an instance of SimpleCov::Result. Do whatever your wish with that! ## Using multiple formatters @@ -568,10 +827,10 @@ As of SimpleCov 0.9, you can specify multiple result formats: ```ruby -SimpleCov.formatters = +SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new( SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::CSVFormatter, - +) ``` ## Available formatters, editor integrations and hosted services @@ -582,14 +841,9 @@ ## Ruby version compatibility -Only Ruby 1.9+ ships with the coverage library that SimpleCov depends upon. -SimpleCov is built against various other Rubies, including Rubinius and JRuby, -in Continuous Integration, but this happens only to ensure that SimpleCov -does not make your test suite crash right now. Whether SimpleCov will support -JRuby/Rubinius in the future depends solely on whether those Ruby interpreters -add the coverage library. +SimpleCov is built in Continuous Integration on Ruby 2.5+ as well as JRuby 9.2+. -SimpleCov is built in Continuous Integration on Ruby 1.9.3, 2.0.0, 2.1, and 2.2. +Note for JRuby => You need to pass JRUBY_OPTS="--debug" or create .jrubyrc and add debug.fullTrace=true ## Want to find dead code in production? @@ -597,32 +851,71 @@ ## Want to use Spring with SimpleCov? -If you're using Spring(https://github.com/rails/spring) to speed up test suite runs and want to run SimpleCov along with them, you'll find that it often misreports coverage with the default config due to some sort of eager loading issue. Don't despair! +If you're using Spring(https://github.com/rails/spring) to speed up test suite runs and want to run SimpleCov along +with them, you'll find that it often misreports coverage with the default config due to some sort of eager loading +issue. Don't despair! -1. Change the following settings in `development.rb` and `test.rb`. +One solution is to explicitly call eager +load(https://github.com/simplecov-ruby/simplecov/issues/381#issuecomment-347651728) +in your `test_helper.rb` / `spec_helper.rb` after calling `SimpleCov.start`. - ```ruby - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_files = false - config.eager_load = false - ``` -2. Add your SimpleCov config, as you normally would, to your `spec_helper.rb` - (or `rails_helper.rb` for RSpec 3). If you have a `config/spring.rb` file - (or anything similar), add it to the start of such file. Here's a simple - version of what the config should look like: +```ruby +require 'simplecov' +SimpleCov.start 'rails' +Rails.application.eager_load! +``` - ```ruby - if ENV'RAILS_ENV' == 'test' - require 'simplecov' - SimpleCov.start - end - ``` -3. Run `spring rspec <path>` as normal. Remember to run `spring stop` after - making important changes to your app or its specs! +Alternatively, you could disable Spring while running SimpleCov: + +``` +DISABLE_SPRING=1 rake test +``` + +Or you could remove `gem 'spring'` from your `Gemfile`. + +## Troubleshooting + +The **most common problem is that simplecov isn't required and started before everything else**. In order to track +coverage for your whole application **simplecov needs to be the first one** so that it (and the underlying coverage +library) can subsequently track loaded files and their usage. + +If you are missing coverage for some code a simple trick is to put a puts statement in there and right after +`SimpleCov.start` so you can see if the file really was loaded after simplecov was started. + +```ruby +# my_code.rb +class MyCode + + puts "MyCode is being loaded!" + + def my_method + # ... + end +end + +# spec_helper.rb/rails_helper.rb/test_helper.rb/.simplecov whatever + +SimpleCov.start +puts "SimpleCov started successfully!" +``` + +Now when you run your test suite and you see: + +``` +SimpleCov started successfully! +MyCode is being loaded! +``` + +then it's good otherwise you likely have a problem :) + +## Code of Conduct + +Everyone participating in this project's development, issue trackers and other channels is expected to follow our +Code of Conduct(./CODE_OF_CONDUCT.md) ## Contributing -See the contributing guide(https://github.com/colszowka/simplecov/blob/master/CONTRIBUTING.md). +See the contributing guide(https://github.com/simplecov-ruby/simplecov/blob/main/CONTRIBUTING.md). ## Kudos @@ -630,4 +923,4 @@ ## Copyright -Copyright (c) 2010-2015 Christoph Olszowka. See MIT-LICENSE for details. +Copyright (c) 2010-2017 Christoph Olszowka. See MIT-LICENSE for details.
View file
_service:tar_scm:simplecov-0.13.0.gem/data/doc/alternate-formatters.md -> _service:tar_scm:simplecov-0.19.1.gem/data/doc/alternate-formatters.md
Changed
@@ -1,7 +1,7 @@ ## Alternate coverage report formatters The community around simplecov provides a whole bunch of alternate formatters beyond the official -simplecov-html(https://github.com/colszowka/simplecov-html) gem. +simplecov-html(https://github.com/simplecov-ruby/simplecov-html) gem. If you have built or found one that is missing here, please send a Pull Request for this document! @@ -10,6 +10,16 @@ A formatter that generates a coverage badge for use in your project's readme using ImageMagick. +#### simplecov-small-badge(https://github.com/marcgrimme/simplecov-small-badge) +*by Marc Grimme* + +A formatter that generates a small coverage badge for use in your project's readme using the SVG. + +#### simplecov_badger(https://github.com/traels-it/simplecov_badger) +*by traels.it* + +A formatter that uploads your coverage to a server, that will then host a SVG badge of the score. No need to have the badge stored in repository. + #### simplecov-cobertura(https://github.com/dashingrocket/simplecov-cobertura) *by Jesse Bowes* @@ -20,11 +30,21 @@ CSV formatter for SimpleCov +#### simplecov-erb(https://github.com/kpaulisse/simplecov-erb) +*by Kevin Paulisse(https://github.com/kpaulisse)* + +Flexible formatter that generates the output from an ERB template. + #### simplecov-json(https://github.com/vicentllongo/simplecov-json) *by Vicent Llongo* JSON formatter for SimpleCov +#### simplecov-lcov(https://github.com/fortissimo1997/simplecov-lcov) +*by fortissimo1997* + +lcov formatter for SimpleCov + #### simplecov-rcov(https://github.com/fguillen/simplecov-rcov) *by Fernando Guillen* @@ -33,4 +53,19 @@ #### simplecov-single_file_reporter(https://github.com/grosser/simplecov-single_file_reporter) *by Michael Grosser(http://grosser.it)* -A formatter that prints the coverage of the file under test when you run a single test file. \ No newline at end of file +A formatter that prints the coverage of the file under test when you run a single test file. + +#### simplecov-t_wada(https://github.com/ysksn/simplecov-t_wada) +*by Yosuke Kabuto(https://github.com/ysksn)* + +t_wada AA formatter for SimpleCov + +#### simplecov-tailwindcss(https://github.com/chiefpansancolt/simplecov-tailwindcss) +*by Chiefpansancolt(https://github.com/chiefpansancolt)* + +A TailwindCSS & TailwindUI Designed HTML formatter with clean and easy search of files with a tabular left Navigation. + +#### simplecov-material(https://github.com/chiefpansancolt/simplecov-material) +*by Chiefpansancolt(https://github.com/chiefpansancolt)* + +A Material Designed HTML formatter with clean and easy search of files with a tabular left Navigation.
View file
_service:tar_scm:simplecov-0.13.0.gem/data/doc/commercial-services.md -> _service:tar_scm:simplecov-0.19.1.gem/data/doc/commercial-services.md
Changed
@@ -4,6 +4,11 @@ reports. Please note these are not associated with the SimpleCov project itself, so please report problems with these integrations with their respective owners. +#### Codacy(https://github.com/codacy/codacy-coverage-reporter) +*by Codacy(https://www.codacy.com/)* + +Upload coverage reports to codacy.com(https://www.codacy.com/), a hosted (or self-hosted) software quality analysis platform that also includes coverage reporting. + #### codeclimate(https://github.com/codeclimate/ruby-test-reporter) *by Code Climate(https://codeclimate.com/)*
View file
_service:tar_scm:simplecov-0.13.0.gem/data/doc/editor-integration.md -> _service:tar_scm:simplecov-0.19.1.gem/data/doc/editor-integration.md
Changed
@@ -7,7 +7,12 @@ Adds an overview of your current test coverage to Atom. +#### Sublime Editor: SimpleCov(https://packagecontrol.io/packages/SimpleCov) +*by sentience* + +Adds in editor live coverage highlighting, status bar coverage information, and summary coverage information. + #### cadre(https://github.com/nyarly/cadre) *by Judson Lester* -Includes a formatter for Simplecov that emits a Vim script to mark up code files with coverage information. \ No newline at end of file +Includes a formatter for Simplecov that emits a Vim script to mark up code files with coverage information.
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/minitest/simplecov_plugin.rb
Added
@@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# How minitest plugins. See https://github.com/simplecov-ruby/simplecov/pull/756 for why we need this. +# https://github.com/seattlerb/minitest#writing-extensions +module Minitest + def self.plugin_simplecov_init(_options) + if defined?(SimpleCov) + SimpleCov.external_at_exit = true + + Minitest.after_run do + SimpleCov.at_exit_behavior + end + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov.rb
Changed
@@ -1,13 +1,14 @@ -# -# Code coverage for ruby 1.9. Please check out README for a full introduction. -# +# frozen_string_literal: true + +require "English" + # Coverage may be inaccurate under JRUBY. if defined?(JRUBY_VERSION) && defined?(JRuby) # @see https://github.com/jruby/jruby/issues/1196 # @see https://github.com/metricfu/metric_fu/pull/226 - # @see https://github.com/colszowka/simplecov/issues/420 - # @see https://github.com/colszowka/simplecov/issues/86 + # @see https://github.com/simplecov-ruby/simplecov/issues/420 + # @see https://github.com/simplecov-ruby/simplecov/issues/86 # @see https://jira.codehaus.org/browse/JRUBY-6106 unless org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED @@ -16,10 +17,18 @@ ' or set the "debug.fullTrace=true" option in your .jrubyrc' end end + +# +# Code coverage for ruby. Please check out README for a full introduction. +# module SimpleCov class << self - attr_accessor :running - attr_accessor :pid + attr_accessor :running, :pid + + # Basically, should we take care of at_exit behavior or something else? + # Used by the minitest plugin. See lib/minitest/simplecov_plugin.rb + attr_accessor :external_at_exit + alias external_at_exit? external_at_exit # # Sets up SimpleCov to run against your project. @@ -39,35 +48,52 @@ # Please check out the RDoc for SimpleCov::Configuration to find about available config options # def start(profile = nil, &block) - if SimpleCov.usable? - load_profile(profile) if profile - configure(&block) if block_given? - @result = nil - self.running = true - self.pid = Process.pid - Coverage.start - else - warn "WARNING: SimpleCov is activated, but you're not running Ruby 1.9+ - no coverage analysis will happen" - warn "Starting with SimpleCov 1.0.0, even no-op compatibility with Ruby <= 1.8 will be entirely dropped." - false - end + require "coverage" + initial_setup(profile, &block) + require_relative "./simplecov/process" if SimpleCov.enabled_for_subprocesses? && + ::Process.respond_to?(:fork) + + make_parallel_tests_available + + @result = nil + self.pid = Process.pid + + start_coverage_measurement end # - # Finds files that were to be tracked but were not loaded and initializes - # their coverage to zero. + # Collate a series of SimpleCov result files into a single SimpleCov output. + # You can optionally specify configuration with a block: + # SimpleCov.collate Dir"simplecov-resultset-*/.resultset.json" + # OR + # SimpleCov.collate Dir"simplecov-resultset-*/.resultset.json", 'rails' # using rails profile + # OR + # SimpleCov.collate Dir"simplecov-resultset-*/.resultset.json" do + # add_filter 'test' + # end + # OR + # SimpleCov.collate Dir"simplecov-resultset-*/.resultset.json", 'rails' do + # add_filter 'test' + # end # - def add_not_loaded_files(result) - if track_files - result = result.dup - Dirtrack_files.each do |file| - absolute = File.expand_path(file) + # Please check out the RDoc for SimpleCov::Configuration to find about + # available config options, or checkout the README for more in-depth + # information about coverage collation + # + def collate(result_filenames, profile = nil, &block) + raise "There's no reports to be merged" if result_filenames.empty? - resultabsolute ||= 0 * File.foreach(absolute).count - end + initial_setup(profile, &block) + + results = result_filenames.flat_map do |filename| + # Re-create each included instance of SimpleCov::Result from the stored run data. + Result.from_hash(JSON.parse(File.read(filename)) || {}) end - result + # Use the ResultMerger to produce a single, merged result, ready to use. + @result = ResultMerger.merge_and_store(*results) + + run_exit_tasks! end # @@ -75,23 +101,20 @@ # from cache using SimpleCov::ResultMerger if use_merging is activated (default) # def result - # Ensure the variable is defined to avoid ruby warnings - @result = nil unless defined?(@result) + return @result if result? # Collect our coverage result - if running && !result? - @result = SimpleCov::Result.new add_not_loaded_files(Coverage.result) - end + process_coverage_result if running # If we're using merging of results, store the current result - # first, then merge the results and return those + # first (if there is one), then merge the results and return those if use_merging + wait_for_other_processes SimpleCov::ResultMerger.store_result(@result) if result? - - SimpleCov::ResultMerger.merged_result - else - @result + @result = SimpleCov::ResultMerger.merged_result end + + @result ensure self.running = false end @@ -144,41 +167,301 @@ end # - # Checks whether we're on a proper version of Ruby (likely 1.9+) which - # provides coverage support + # Clear out the previously cached .result. Primarily useful in testing # - def usable? - return @usable if defined?(@usable) && !@usable.nil? + def clear_result + @result = nil + end + + def at_exit_behavior + # If we are in a different process than called start, don't interfere. + return if SimpleCov.pid != Process.pid - @usable = begin - require "coverage" - require "simplecov/jruby_fix" - true - rescue LoadError - false + # If SimpleCov is no longer running then don't run exit tasks + SimpleCov.run_exit_tasks! if SimpleCov.running + end + + # @api private + # + # Called from at_exit block + # + def run_exit_tasks! + error_exit_status = exit_status_from_exception + + at_exit.call + + exit_and_report_previous_error(error_exit_status) if previous_error?(error_exit_status) + process_results_and_report_error if ready_to_process_results? + end + + # + # @api private + # + # Returns the exit status from the exit exception + # + def exit_status_from_exception + # Capture the current exception if it exists + @exit_exception = $ERROR_INFO + return nil unless @exit_exception + + if @exit_exception.is_a?(SystemExit) + @exit_exception.status + else + SimpleCov::ExitCodes::EXCEPTION + end + end + + # @api private + def previous_error?(error_exit_status) + # Normally it'd be enough to check for previous error but when running test_unit + # status is 0 + error_exit_status && error_exit_status != SimpleCov::ExitCodes::SUCCESS + end + + # + # @api private + # + # Thinking: Move this behavior earlier so if there was an error we do nothing? + def exit_and_report_previous_error(exit_status) + warn("Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected") if print_error_status + Kernel.exit(exit_status) + end + + # @api private + def ready_to_process_results? + final_result_process? && result? + end + + def process_results_and_report_error + exit_status = process_result(result) + + # Force exit with stored status (see github issue #5) + if exit_status.positive? + warn("SimpleCov failed with exit #{exit_status} due to a coverage related error") if print_error_status + Kernel.exit exit_status end end + + # @api private + # + # Usage: + # exit_status = SimpleCov.process_result(SimpleCov.result, exit_status) + # + def process_result(result) + result_exit_status = result_exit_status(result) + write_last_run(result) if result_exit_status == SimpleCov::ExitCodes::SUCCESS + result_exit_status + end + + # @api private + CoverageLimits = Struct.new(:minimum_coverage, :minimum_coverage_by_file, :maximum_coverage_drop, keyword_init: true) + def result_exit_status(result) + coverage_limits = CoverageLimits.new( + minimum_coverage: minimum_coverage, minimum_coverage_by_file: minimum_coverage_by_file, + maximum_coverage_drop: maximum_coverage_drop + ) + + ExitCodes::ExitCodeHandling.call(result, coverage_limits: coverage_limits) + end + + # + # @api private + # + def final_result_process? + # checking for ENV"TEST_ENV_NUMBER" to determine if the tests are being run in parallel + !defined?(ParallelTests) || !ENV"TEST_ENV_NUMBER" || ParallelTests.last_process? + end + + # + # @api private + # + def wait_for_other_processes + return unless defined?(ParallelTests) && final_result_process? + + ParallelTests.wait_for_other_processes_to_finish + end + + # + # @api private + # + def write_last_run(result) + SimpleCov::LastRun.write(result: {covered_percent: round_coverage(result.covered_percent)}) + end + + # + # @api private + # + # Rounding down to be extra strict, see #679 + def round_coverage(coverage) + coverage.floor(2) + end + + private + + def initial_setup(profile, &block) + load_profile(profile) if profile + configure(&block) if block_given? + self.running = true + end + + # + # Trigger Coverage.start depends on given config coverage_criterion + # + # With Positive branch it supports all coverage measurement types + # With Negative branch it supports only line coverage measurement type + # + def start_coverage_measurement + # This blog post gives a good run down of the coverage criterias introduced + # in Ruby 2.5: https://blog.bigbinary.com/2018/04/11/ruby-2-5-supports-measuring-branch-and-method-coverages.html + # There is also a nice writeup of the different coverage criteria made in this + # comment https://github.com/simplecov-ruby/simplecov/pull/692#discussion_r281836176 : + # Ruby < 2.5: + # https://github.com/ruby/ruby/blob/v1_9_3_374/ext/coverage/coverage.c + # traditional mode (Array) + # + # Ruby 2.5: + # https://bugs.ruby-lang.org/issues/13901 + # https://github.com/ruby/ruby/blob/v2_5_3/ext/coverage/coverage.c + # default: traditional/compatible mode (Array) + # :lines - like traditional mode but using Hash + # :branches + # :methods + # :all - same as lines + branches + methods + # + # Ruby >= 2.6: + # https://bugs.ruby-lang.org/issues/15022 + # https://github.com/ruby/ruby/blob/v2_6_3/ext/coverage/coverage.c + # default: traditional/compatible mode (Array) + # :lines - like traditional mode but using Hash + # :branches + # :methods + # :oneshot_lines - can not be combined with lines + # :all - same as lines + branches + methods + # + if coverage_start_arguments_supported? + start_coverage_with_criteria + else + Coverage.start + end + end + + def start_coverage_with_criteria + start_arguments = coverage_criteria.map do |criterion| + lookup_corresponding_ruby_coverage_name(criterion), true + end.to_h + + Coverage.start(start_arguments) + end + + CRITERION_TO_RUBY_COVERAGE = { + branch: :branches, + line: :lines + }.freeze + def lookup_corresponding_ruby_coverage_name(criterion) + CRITERION_TO_RUBY_COVERAGE.fetch(criterion) + end + + # + # Finds files that were to be tracked but were not loaded and initializes + # the line-by-line coverage to zero (if relevant) or nil (comments / whitespace etc). + # + def add_not_loaded_files(result) + if tracked_files + result = result.dup + Dirtracked_files.each do |file| + absolute_path = File.expand_path(file) + resultabsolute_path ||= SimulateCoverage.call(absolute_path) + end + end + + result + end + + # + # Call steps that handle process coverage result + # + # @return Hash + # + def process_coverage_result + adapt_coverage_result + remove_useless_results + result_with_not_loaded_files + end + + # + # Unite the result so it wouldn't matter what coverage type was called + # + # @return Hash + # + def adapt_coverage_result + @result = SimpleCov::ResultAdapter.call(Coverage.result) + end + + # + # Filter coverage result + # The result before filter also has result of coverage for files + # are not related to the project like loaded gems coverage. + # + # @return Hash + # + def remove_useless_results + @result = SimpleCov::UselessResultsRemover.call(@result) + end + + # + # Initialize result with files that are not included by coverage + # and added inside the config block + # + # @return Hash + # + def result_with_not_loaded_files + @result = SimpleCov::Result.new(add_not_loaded_files(@result)) + end + + # parallel_tests isn't always available, see: https://github.com/grosser/parallel_tests/issues/772 + def make_parallel_tests_available + return if defined?(ParallelTests) + return unless probably_running_parallel_tests? + + require "parallel_tests" + rescue LoadError + warn("SimpleCov guessed you were running inside parallel tests but couldn't load it. Please file a bug report with us!") + end + + def probably_running_parallel_tests? + ENV"TEST_ENV_NUMBER" && ENV"PARALLEL_TEST_GROUPS" + end end end -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__))) -require "simplecov/configuration" -SimpleCov.send :extend, SimpleCov::Configuration -require "simplecov/exit_codes" -require "simplecov/profiles" -require "simplecov/source_file" -require "simplecov/file_list" -require "simplecov/result" -require "simplecov/filter" -require "simplecov/formatter" -require "simplecov/last_run" -require "simplecov/merge_helpers" -require "simplecov/result_merger" -require "simplecov/command_guesser" -require "simplecov/version" +# requires are down here here for a load order reason I'm not sure what it is about +require "set" +require "forwardable" +require_relative "simplecov/configuration" +SimpleCov.extend SimpleCov::Configuration +require_relative "simplecov/coverage_statistics" +require_relative "simplecov/exit_codes" +require_relative "simplecov/profiles" +require_relative "simplecov/source_file/line" +require_relative "simplecov/source_file/branch" +require_relative "simplecov/source_file" +require_relative "simplecov/file_list" +require_relative "simplecov/result" +require_relative "simplecov/filter" +require_relative "simplecov/formatter" +require_relative "simplecov/last_run" +require_relative "simplecov/lines_classifier" +require_relative "simplecov/result_merger" +require_relative "simplecov/command_guesser" +require_relative "simplecov/version" +require_relative "simplecov/result_adapter" +require_relative "simplecov/combine" +require_relative "simplecov/combine/branches_combiner" +require_relative "simplecov/combine/files_combiner" +require_relative "simplecov/combine/lines_combiner" +require_relative "simplecov/combine/results_combiner" +require_relative "simplecov/useless_results_remover" +require_relative "simplecov/simulate_coverage" # Load default config -require "simplecov/defaults" unless ENV"SIMPLECOV_NO_DEFAULTS" - -# Load Rails integration (only for Rails 3, see #113) -require "simplecov/railtie" if defined? Rails::Railtie +require_relative "simplecov/defaults" unless ENV"SIMPLECOV_NO_DEFAULTS"
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/combine.rb
Added
@@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module SimpleCov + # Functionally for combining coverage results + # + module Combine + module_function + + # + # Combine two coverage based on the given combiner_module. + # + # Combiners should always be called through this interface, + # as it takes care of short-circuiting of one of the coverages is nil. + # + # @return Hash + def combine(combiner_module, coverage_a, coverage_b) + return existing_coverage(coverage_a, coverage_b) if empty_coverage?(coverage_a, coverage_b) + + combiner_module.combine(coverage_a, coverage_b) + end + + def empty_coverage?(coverage_a, coverage_b) + !(coverage_a && coverage_b) + end + + def existing_coverage(coverage_a, coverage_b) + coverage_a || coverage_b + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/combine/branches_combiner.rb
Added
@@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module SimpleCov + module Combine + # + # Combine different branch coverage results on single file. + # + # Should be called through `SimpleCov.combine`. + module BranchesCombiner + module_function + + # + # Return merged branches or the existed brach if other is missing. + # + # Branches inside files are always same if they exist, the difference only in coverage count. + # Branch coverage report for any conditional case is built from hash, it's key is a condition and + # it's body is a hash << keys from condition and value is coverage rate >>. + # ex: branches =>{ :if, 3, 8, 6, 8, 36 => {:then, 4, 8, 6, 8, 12 => 1, :else, 5, 8, 6, 8, 36=>2}, other conditions...} + # We create copy of result and update it values depending on the combined branches coverage values. + # + # @return Hash + # + def combine(coverage_a, coverage_b) + coverage_a.merge(coverage_b) do |_condition, branches_inside_a, branches_inside_b| + branches_inside_a.merge(branches_inside_b) do |_branch, a_count, b_count| + a_count + b_count + end + end + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/combine/files_combiner.rb
Added
@@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module SimpleCov + module Combine + # + # Handle combining two coverage results for same file + # + # Should be called through `SimpleCov.combine`. + module FilesCombiner + module_function + + # + # Combines the results for 2 coverages of a file. + # + # @return Hash + # + def combine(coverage_a, coverage_b) + combination = {"lines" => Combine.combine(LinesCombiner, coverage_a"lines", coverage_b"lines")} + combination"branches" = Combine.combine(BranchesCombiner, coverage_a"branches", coverage_b"branches") if SimpleCov.branch_coverage? + combination + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/combine/lines_combiner.rb
Added
@@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module SimpleCov + module Combine + # + # Combine two different lines coverage results on same file + # + # Should be called through `SimpleCov.combine`. + module LinesCombiner + module_function + + def combine(coverage_a, coverage_b) + coverage_a + .zip(coverage_b) + .map do |coverage_a_val, coverage_b_val| + merge_line_coverage(coverage_a_val, coverage_b_val) + end + end + + # Return depends on coverage in a specific line + # + # @param Integer || nil first_val + # @param Integer || nil second_val + # + # Logic: + # + # => nil + 0 = nil + # => nil + nil = nil + # => int + int = int + # + # @return Integer || nil + def merge_line_coverage(first_val, second_val) + sum = first_val.to_i + second_val.to_i + + if sum.zero? && (first_val.nil? || second_val.nil?) + nil + else + sum + end + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/combine/results_combiner.rb
Added
@@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module SimpleCov + module Combine + # There might be reports from different kinds of tests, + # e.g. RSpec and Cucumber. We need to combine their results + # into unified one. This class does that. + # To unite the results on file basis, it leverages + # the combine of lines and branches inside each file within given results. + module ResultsCombiner + module_function + + # + # Combine process explanation + # => ResultCombiner: define all present files between results and start combine on file level. + # ==> FileCombiner: collect result of next combine levels lines and branches. + # ===> LinesCombiner: combine lines results. + # ===> BranchesCombiner: combine branches results. + # + # @return Hash + # + def combine(*results) + results.reduce({}) do |combined_results, next_result| + combine_result_sets(combined_results, next_result) + end + end + + # + # Manage combining results on files level + # + # @param Hash combined_results + # @param Hash result + # + # @return Hash + # + def combine_result_sets(combined_results, result) + results_files = combined_results.keys | result.keys + + results_files.each_with_object({}) do |file_name, file_combination| + file_combinationfile_name = combine_file_coverage( + combined_resultsfile_name, + resultfile_name + ) + end + end + + # + # Combine two files coverage results + # + # @param Hash coverage_a + # @param Hash coverage_b + # + # @return Hash + # + def combine_file_coverage(coverage_a, coverage_b) + Combine.combine(Combine::FilesCombiner, coverage_a, coverage_b) + end + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/command_guesser.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/command_guesser.rb
Changed
@@ -1,7 +1,9 @@ -# -# Helper that tries to find out what test suite is running (for SimpleCov.command_name) -# +# frozen_string_literal: true + module SimpleCov + # + # Helper that tries to find out what test suite is running (for SimpleCov.command_name) + # module CommandGuesser class << self # Storage for the original command line call that invoked the test suite. @@ -20,6 +22,7 @@ def from_env # If being run from inside parallel_tests set the command name according to the process number return unless ENV"PARALLEL_TEST_GROUPS" && ENV"TEST_ENV_NUMBER" + number = ENV"TEST_ENV_NUMBER" number = "1" if number.empty? "(#{number}/#{ENV'PARALLEL_TEST_GROUPS'})" @@ -46,6 +49,8 @@ "RSpec" elsif defined?(Test::Unit) "Unit Tests" + elsif defined?(Minitest) + "Minitest" elsif defined?(MiniTest) "MiniTest" else
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/configuration.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/configuration.rb
Changed
@@ -1,14 +1,17 @@ +# frozen_string_literal: true + require "fileutils" require "docile" -require "simplecov/formatter/multi_formatter" -# -# Bundles the configuration options used for SimpleCov. All methods -# defined here are usable from SimpleCov directly. Please check out -# SimpleCov documentation for further info. -# +require_relative "formatter/multi_formatter" + module SimpleCov - module Configuration # rubocop:disable ModuleLength - attr_writer :filters, :groups, :formatter + # + # Bundles the configuration options used for SimpleCov. All methods + # defined here are usable from SimpleCov directly. Please check out + # SimpleCov documentation for further info. + # + module Configuration # rubocop:disable Metrics/ModuleLength + attr_writer :filters, :groups, :formatter, :print_error_status # # The root for the project. This defaults to the @@ -18,6 +21,7 @@ # def root(root = nil) return @root if defined?(@root) && root.nil? + @root = File.expand_path(root || Dir.getwd) end @@ -28,6 +32,7 @@ # def coverage_dir(dir = nil) return @coverage_dir if defined?(@coverage_dir) && dir.nil? + @coverage_path = nil # invalidate cache @coverage_dir = (dir || "coverage") end @@ -50,9 +55,16 @@ # or not they were explicitly required. Without this, un-required files # will not be present in the final report. # - def track_files(glob = nil) - return @track_files if defined?(@track_files) && glob.nil? - @track_files = glob + def track_files(glob) + @tracked_files = glob + end + + # + # Returns the glob that will be used to include files that were not + # explicitly required. + # + def tracked_files + @tracked_files if defined?(@tracked_files) end # @@ -84,8 +96,10 @@ # def formatter(formatter = nil) return @formatter if defined?(@formatter) && formatter.nil? + @formatter = formatter raise "No formatter configured. Please specify a formatter using SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter" unless @formatter + @formatter end @@ -108,6 +122,14 @@ end # + # Whether we should print non-success status codes. This can be + # configured with the #print_error_status= method. + # + def print_error_status + defined?(@print_error_status) ? @print_error_status : true + end + + # # Certain code blocks (i.e. Ruby-implementation specific code) can be excluded from # the coverage metrics by wrapping it inside # :nocov: comment blocks. The nocov token # can be configured to be any other string using this. @@ -116,6 +138,7 @@ # def nocov_token(nocov_token = nil) return @nocov_token if defined?(@nocov_token) && nocov_token.nil? + @nocov_token = (nocov_token || "nocov") end alias skip_token nocov_token @@ -143,15 +166,14 @@ # Allows you to configure simplecov in a block instead of prepending SimpleCov to all config methods # you're calling. # - # SimpleCov.configure do - # add_filter 'foobar' - # end + # SimpleCov.configure do + # add_filter 'foobar' + # end # # This is equivalent to SimpleCov.add_filter 'foobar' and thus makes it easier to set a bunch of configure # options at once. # def configure(&block) - return false unless SimpleCov.usable? Docile.dsl_eval(self, &block) end @@ -161,23 +183,73 @@ # By default, it will call SimpleCov.result.format! # # Configure with: - # SimpleCov.at_exit do - # puts "Coverage done" - # SimpleCov.result.format! - # end + # + # SimpleCov.at_exit do + # puts "Coverage done" + # SimpleCov.result.format! + # end # def at_exit(&block) return proc {} unless running || block_given? + @at_exit = block if block_given? @at_exit ||= proc { SimpleCov.result.format! } end + # gets or sets the enabled_for_subprocess configuration + # when true, this will inject SimpleCov code into Process.fork + def enable_for_subprocesses(value = nil) + return @enable_for_subprocesses if defined?(@enable_for_subprocesses) && value.nil? + + @enable_for_subprocesses = value || false + end + + # gets the enabled_for_subprocess configuration + def enabled_for_subprocesses? + enable_for_subprocesses + end + + # + # Gets or sets the behavior to start a new forked Process. + # + # By default, it will add " (Process #{pid})" to the command_name, and start SimpleCov in quiet mode + # + # Configure with: + # + # SimpleCov.at_fork do |pid| + # SimpleCov.start do + # # This needs a unique name so it won't be ovewritten + # SimpleCov.command_name "#{SimpleCov.command_name} (subprocess: #{pid})" + # # be quiet, the parent process will be in charge of using the regular formatter and checking coverage totals + # SimpleCov.print_error_status = false + # SimpleCov.formatter SimpleCov::Formatter::SimpleFormatter + # SimpleCov.minimum_coverage 0 + # # start + # SimpleCov.start + # end + # end + # + def at_fork(&block) + @at_fork = block if block_given? + @at_fork ||= lambda { |pid| + # This needs a unique name so it won't be ovewritten + SimpleCov.command_name "#{SimpleCov.command_name} (subprocess: #{pid})" + # be quiet, the parent process will be in charge of using the regular formatter and checking coverage totals + SimpleCov.print_error_status = false + SimpleCov.formatter SimpleCov::Formatter::SimpleFormatter + SimpleCov.minimum_coverage 0 + # start + SimpleCov.start + } + end + # # Returns the project name - currently assuming the last dirname in # the SimpleCov.root is this. # def project_name(new_name = nil) return @project_name if defined?(@project_name) && @project_name && new_name.nil? + @project_name = new_name if new_name.is_a?(String) @project_name ||= File.basename(root.split("/").last).capitalize.tr("_", " ") end @@ -214,9 +286,20 @@ # # Default is 0% (disabled) # + + # rubocop:disable Metrics/CyclomaticComplexity def minimum_coverage(coverage = nil) - @minimum_coverage ||= (coverage || 0).to_f.round(2) + return @minimum_coverage ||= {} unless coverage + + coverage = {DEFAULT_COVERAGE_CRITERION => coverage} if coverage.is_a?(Numeric) + coverage.each_key { |criterion| raise_if_criterion_disabled(criterion) } + coverage.each_value do |percent| + minimum_possible_coverage_exceeded("minimum_coverage") if percent && percent > 100 + end + + @minimum_coverage = coverage end + # rubocop:enable Metrics/CyclomaticComplexity # # Defines the maximum coverage drop at once allowed for the testsuite to pass. @@ -236,6 +319,7 @@ # Default is 0% (disabled) # def minimum_coverage_by_file(coverage = nil) + minimum_possible_coverage_exceeded("minimum_coverage_by_file") if coverage && coverage > 100 @minimum_coverage_by_file ||= (coverage || 0).to_f.round(2) end @@ -249,15 +333,18 @@ # # Add a filter to the processing chain. - # There are three ways to define a filter: + # There are four ways to define a filter: # # * as a String that will then be matched against all source files' file paths, - # SimpleCov.add_filter 'app/models' # will reject all your models + # SimpleCov.add_filter 'app/models' # will reject all your models # * as a block which will be passed the source file in question and should either # return a true or false value, depending on whether the file should be removed - # SimpleCov.add_filter do |src_file| - # File.basename(src_file.filename) == 'environment.rb' - # end # Will exclude environment.rb files from the results + # SimpleCov.add_filter do |src_file| + # File.basename(src_file.filename) == 'environment.rb' + # end # Will exclude environment.rb files from the results + # * as an array of strings that are matched against all sorce files' file + # paths and then ignored (basically string filter multiple times) + # SimpleCov.add_filter 'app/models', 'app/helpers' # ignores both dirs # * as an instance of a subclass of SimpleCov::Filter. See the documentation there # on how to define your own filter classes # @@ -274,22 +361,95 @@ groupsgroup_name = parse_filter(filter_argument, &filter_proc) end + SUPPORTED_COVERAGE_CRITERIA = %iline branch.freeze + DEFAULT_COVERAGE_CRITERION = :line + # + # Define which coverage criterion should be evaluated. + # + # Possible coverage criteria: + # * :line - coverage based on lines aka has this line been executed? + # * :branch - coverage based on branches aka has this branch (think conditions) been executed? + # + # If not set the default is `:line` + # + # @param Symbol criterion + # + def coverage_criterion(criterion = nil) + return @coverage_criterion ||= DEFAULT_COVERAGE_CRITERION unless criterion + + raise_if_criterion_unsupported(criterion) + + @coverage_criterion = criterion + end + + def enable_coverage(criterion) + raise_if_criterion_unsupported(criterion) + + coverage_criteria << criterion + end + + def coverage_criteria + @coverage_criteria ||= SetDEFAULT_COVERAGE_CRITERION + end + + def coverage_criterion_enabled?(criterion) + coverage_criteria.member?(criterion) + end + + def clear_coverage_criteria + @coverage_criteria = nil + end + + def branch_coverage? + branch_coverage_supported? && coverage_criterion_enabled?(:branch) + end + + def coverage_start_arguments_supported? + # safe to cache as within one process this value should never + # change + return @coverage_start_arguments_supported if defined?(@coverage_start_arguments_supported) + + @coverage_start_arguments_supported = begin + require "coverage" + !Coverage.method(:start).arity.zero? + end + end + + alias branch_coverage_supported? coverage_start_arguments_supported? + private + def raise_if_criterion_disabled(criterion) + raise_if_criterion_unsupported(criterion) + # rubocop:disable Style/IfUnlessModifier + unless coverage_criterion_enabled?(criterion) + raise "Coverage criterion #{criterion}, is disabled! Please enable it first through enable_coverage #{criterion} (if supported)" + end + # rubocop:enable Style/IfUnlessModifier + end + + def raise_if_criterion_unsupported(criterion) + # rubocop:disable Style/IfUnlessModifier + unless SUPPORTED_COVERAGE_CRITERIA.member?(criterion) + raise "Unsupported coverage criterion #{criterion}, supported values are #{SUPPORTED_COVERAGE_CRITERIA}" + end + # rubocop:enable Style/IfUnlessModifier + end + + def minimum_possible_coverage_exceeded(coverage_option) + warn "The coverage you set for #{coverage_option} is greater than 100%" + end + # - # The actal filter processor. Not meant for direct use + # The actual filter processor. Not meant for direct use # def parse_filter(filter_argument = nil, &filter_proc) - if filter_argument.is_a?(SimpleCov::Filter) - filter_argument - elsif filter_argument.is_a?(String) - SimpleCov::StringFilter.new(filter_argument) - elsif filter_proc - SimpleCov::BlockFilter.new(filter_proc) - elsif filter_argument.is_a?(Array) - SimpleCov::ArrayFilter.new(filter_argument) + filter = filter_argument || filter_proc + + if filter + SimpleCov::Filter.build_filter(filter) else - raise ArgumentError, "Please specify either a string or a block to filter with" + raise ArgumentError, "Please specify either a filter or a block to filter with" end end end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/coverage_statistics.rb
Added
@@ -0,0 +1,56 @@ +# frozen_string_literal: true + +module SimpleCov + # Holds the individual data of a coverage result. + # + # This is uniform across coverage criteria as they all have: + # + # * total - how many things to cover there are (total relevant loc/branches) + # * covered - how many of the coverables are hit + # * missed - how many of the coverables are missed + # * percent - percentage as covered/missed + # * strength - average hits per/coverable (will not exist for one shot lines format) + class CoverageStatistics + attr_reader :total, :covered, :missed, :strength, :percent + + def self.from(coverage_statistics) + sum_covered, sum_missed, sum_total_strength = + coverage_statistics.reduce(0, 0, 0.0) do |(covered, missed, total_strength), file_coverage_statistics| + + covered + file_coverage_statistics.covered, + missed + file_coverage_statistics.missed, + # gotta remultiply with loc because files have different strength and loc + # giving them a different "weight" in total + total_strength + (file_coverage_statistics.strength * file_coverage_statistics.total) + + end + + new(covered: sum_covered, missed: sum_missed, total_strength: sum_total_strength) + end + + # Requires only covered, missed and strength to be initialized. + # + # Other values are computed by this class. + def initialize(covered:, missed:, total_strength: 0.0) + @covered = covered + @missed = missed + @total = covered + missed + @percent = compute_percent(covered, missed, total) + @strength = compute_strength(total_strength, total) + end + + private + + def compute_percent(covered, missed, total) + return 100.0 if missed.zero? + + covered * 100.0 / total + end + + def compute_strength(total_strength, total) + return 0.0 if total.zero? + + total_strength.to_f / total + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/defaults.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/defaults.rb
Changed
@@ -1,47 +1,19 @@ +# frozen_string_literal: true + # Load default formatter gem require "simplecov-html" require "pathname" - -SimpleCov.profiles.define "root_filter" do - # Exclude all files outside of simplecov root - root_filter = nil - add_filter do |src| - root_filter ||= /\A#{Regexp.escape(SimpleCov.root)}/io - !(src.filename =~ root_filter) - end -end - -SimpleCov.profiles.define "test_frameworks" do - add_filter "/test/" - add_filter "/features/" - add_filter "/spec/" - add_filter "/autotest/" -end - -SimpleCov.profiles.define "bundler_filter" do - add_filter "/vendor/bundle/" -end - -SimpleCov.profiles.define "rails" do - load_profile "test_frameworks" - - add_filter "/config/" - add_filter "/db/" - - add_group "Controllers", "app/controllers" - add_group "Models", "app/models" - add_group "Mailers", "app/mailers" - add_group "Helpers", "app/helpers" - add_group "Jobs", %w(app/jobs app/workers) - add_group "Libraries", "lib" - - track_files "{app,lib}/**/*.rb" -end +require_relative "profiles/root_filter" +require_relative "profiles/test_frameworks" +require_relative "profiles/bundler_filter" +require_relative "profiles/hidden_filter" +require_relative "profiles/rails" # Default configuration SimpleCov.configure do formatter SimpleCov::Formatter::HTMLFormatter load_profile "bundler_filter" + load_profile "hidden_filter" # Exclude files outside of SimpleCov.root load_profile "root_filter" end @@ -49,58 +21,14 @@ # Gotta stash this a-s-a-p, see the CommandGuesser class and i.e. #110 for further info SimpleCov::CommandGuesser.original_run_command = "#{$PROGRAM_NAME} #{ARGV.join(' ')}" -at_exit do # rubocop:disable Metrics/BlockLength - # If we are in a different process than called start, don't interfere. - next if SimpleCov.pid != Process.pid - - @exit_status = if $! # was an exception thrown? - # if it was a SystemExit, use the accompanying status - # otherwise set a non-zero status representing termination by - # some other exception (see github issue 41) - $!.is_a?(SystemExit) ? $!.status : SimpleCov::ExitCodes::EXCEPTION - else - # Store the exit status of the test run since it goes away - # after calling the at_exit proc... - SimpleCov::ExitCodes::SUCCESS - end - - SimpleCov.at_exit.call - - if SimpleCov.result? # Result has been computed - covered_percent = SimpleCov.result.covered_percent.round(2) - covered_percentages = SimpleCov.result.covered_percentages.map { |p| p.round(2) } +at_exit do + next if SimpleCov.external_at_exit? - if @exit_status == SimpleCov::ExitCodes::SUCCESS # No other errors - if covered_percent < SimpleCov.minimum_coverage # rubocop:disable Metrics/BlockNesting - $stderr.printf("Coverage (%.2f%%) is below the expected minimum coverage (%.2f%%).\n", covered_percent, SimpleCov.minimum_coverage) - @exit_status = SimpleCov::ExitCodes::MINIMUM_COVERAGE - elsif covered_percentages.any? { |p| p < SimpleCov.minimum_coverage_by_file } # rubocop:disable Metrics/BlockNesting - $stderr.printf("File (%s) is only (%.2f%%) covered. This is below the expected minimum coverage per file of (%.2f%%).\n", SimpleCov.result.least_covered_file, covered_percentages.min, SimpleCov.minimum_coverage_by_file) - @exit_status = SimpleCov::ExitCodes::MINIMUM_COVERAGE - elsif (last_run = SimpleCov::LastRun.read) # rubocop:disable Metrics/BlockNesting - diff = last_run"result""covered_percent" - covered_percent - if diff > SimpleCov.maximum_coverage_drop # rubocop:disable Metrics/BlockNesting - $stderr.printf("Coverage has dropped by %.2f%% since the last time (maximum allowed: %.2f%%).\n", diff, SimpleCov.maximum_coverage_drop) - @exit_status = SimpleCov::ExitCodes::MAXIMUM_COVERAGE_DROP - end - end - end - - SimpleCov::LastRun.write(:result => {:covered_percent => covered_percent}) - end - - # Force exit with stored status (see github issue #5) - # unless it's nil or 0 (see github issue #281) - Kernel.exit @exit_status if @exit_status && @exit_status > 0 + SimpleCov.at_exit_behavior end # Autoload config from ~/.simplecov if present -require "etc" -home_dir = File.expand_path("~") || Etc.getpwuid.dir || (ENV"USER" && File.expand_path("~#{ENV'USER'}")) -if home_dir - global_config_path = File.join(home_dir, ".simplecov") - load global_config_path if File.exist?(global_config_path) -end +require_relative "load_global_config" # Autoload config from .simplecov if present # Recurse upwards until we find .simplecov or reach the root directory @@ -112,7 +40,7 @@ begin load filename rescue LoadError, StandardError - $stderr.puts "Warning: Error occurred while trying to load #{filename}. " \ + warn "Warning: Error occurred while trying to load #{filename}. " \ "Error message: #{$!.message}" end break
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/exit_codes.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/exit_codes.rb
Changed
@@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SimpleCov module ExitCodes SUCCESS = 0 @@ -6,3 +8,8 @@ MAXIMUM_COVERAGE_DROP = 3 end end + +require_relative "exit_codes/exit_code_handling" +require_relative "exit_codes/maximum_coverage_drop_check" +require_relative "exit_codes/minimum_coverage_by_file_check" +require_relative "exit_codes/minimum_overall_coverage_check"
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/exit_codes/exit_code_handling.rb
Added
@@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module SimpleCov + module ExitCodes + module ExitCodeHandling + module_function + + def call(result, coverage_limits:) + checks = coverage_checks(result, coverage_limits) + + failing_check = checks.find(&:failing?) + if failing_check + failing_check.report + failing_check.exit_code + else + SimpleCov::ExitCodes::SUCCESS + end + end + + def coverage_checks(result, coverage_limits) + + MinimumOverallCoverageCheck.new(result, coverage_limits.minimum_coverage), + MinimumCoverageByFileCheck.new(result, coverage_limits.minimum_coverage_by_file), + MaximumCoverageDropCheck.new(result, coverage_limits.maximum_coverage_drop) + + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/exit_codes/maximum_coverage_drop_check.rb
Added
@@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module SimpleCov + module ExitCodes + class MaximumCoverageDropCheck + def initialize(result, maximum_coverage_drop) + @result = result + @maximum_coverage_drop = maximum_coverage_drop + end + + def failing? + return false unless maximum_coverage_drop && last_run + + coverage_diff > maximum_coverage_drop + end + + def report + $stderr.printf( + "Coverage has dropped by %<drop_percent>.2f%% since the last time (maximum allowed: %<max_drop>.2f%%).\n", + drop_percent: coverage_diff, + max_drop: maximum_coverage_drop + ) + end + + def exit_code + SimpleCov::ExitCodes::MAXIMUM_COVERAGE_DROP + end + + private + + attr_reader :result, :maximum_coverage_drop + + def last_run + return @last_run if defined?(@last_run) + + @last_run = SimpleCov::LastRun.read + end + + def coverage_diff + raise "Trying to access coverage_diff although there is no last run" unless last_run + + @coverage_diff ||= last_run:result:covered_percent - covered_percent + end + + def covered_percent + SimpleCov.round_coverage(result.covered_percent) + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb
Added
@@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module SimpleCov + module ExitCodes + class MinimumCoverageByFileCheck + def initialize(result, minimum_coverage_by_file) + @result = result + @minimum_coverage_by_file = minimum_coverage_by_file + end + + def failing? + covered_percentages.any? { |p| p < minimum_coverage_by_file } + end + + def report + $stderr.printf( + "File (%<file>s) is only (%<least_covered_percentage>.2f%%) covered. This is below the expected minimum coverage per file of (%<min_coverage>.2f%%).\n", + file: result.least_covered_file, + least_covered_percentage: covered_percentages.min, + min_coverage: minimum_coverage_by_file + ) + end + + def exit_code + SimpleCov::ExitCodes::MINIMUM_COVERAGE + end + + private + + attr_reader :result, :minimum_coverage_by_file + + def covered_percentages + @covered_percentages ||= + result.covered_percentages.map { |percentage| SimpleCov.round_coverage(percentage) } + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/exit_codes/minimum_overall_coverage_check.rb
Added
@@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module SimpleCov + module ExitCodes + class MinimumOverallCoverageCheck + def initialize(result, minimum_coverage) + @result = result + @minimum_coverage = minimum_coverage + end + + def failing? + minimum_violations.any? + end + + def report + minimum_violations.each do |violation| + $stderr.printf( + "%<criterion>s coverage (%<covered>.2f%%) is below the expected minimum coverage (%<minimum_coverage>.2f%%).\n", + covered: SimpleCov.round_coverage(violation.fetch(:actual)), + minimum_coverage: violation.fetch(:minimum_expected), + criterion: violation.fetch(:criterion).capitalize + ) + end + end + + def exit_code + SimpleCov::ExitCodes::MINIMUM_COVERAGE + end + + private + + attr_reader :result, :minimum_coverage + + def minimum_violations + @minimum_violations ||= calculate_minimum_violations + end + + def calculate_minimum_violations + coverage_achieved = minimum_coverage.map do |criterion, percent| + { + criterion: criterion, + minimum_expected: percent, + actual: result.coverage_statistics.fetch(criterion).percent + } + end + + coverage_achieved.select do |achieved| + achieved.fetch(:actual) < achieved.fetch(:minimum_expected) + end + end + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/file_list.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/file_list.rb
Changed
@@ -1,29 +1,54 @@ -# An array of SimpleCov SourceFile instances with additional collection helper -# methods for calculating coverage across them etc. +# frozen_string_literal: true + module SimpleCov - class FileList < Array + # An array of SimpleCov SourceFile instances with additional collection helper + # methods for calculating coverage across them etc. + class FileList + include Enumerable + extend Forwardable + + def_delegators :@files, + # For Enumerable + :each, + # also delegating methods implemented in Enumerable as they have + # custom Array implementations which are presumably better/more + # resource efficient + :size, :map, :count, + # surprisingly not in Enumerable + :empty?, :length, + # still act like we're kinda an array + :to_a, :to_ary + + def initialize(files) + @files = files + end + + def coverage_statistics + @coverage_statistics ||= compute_coverage_statistics + end + # Returns the count of lines that have coverage def covered_lines - return 0.0 if empty? - map { |f| f.covered_lines.count }.inject(&:+) + coverage_statistics:line&.covered end # Returns the count of lines that have been missed def missed_lines - return 0.0 if empty? - map { |f| f.missed_lines.count }.inject(&:+) + coverage_statistics:line&.missed end # Returns the count of lines that are not relevant for coverage def never_lines return 0.0 if empty? - map { |f| f.never_lines.count }.inject(&:+) + + map { |f| f.never_lines.count }.inject(:+) end # Returns the count of skipped lines def skipped_lines return 0.0 if empty? - map { |f| f.skipped_lines.count }.inject(&:+) + + map { |f| f.skipped_lines.count }.inject(:+) end # Computes the coverage based upon lines covered and lines missed for each file @@ -34,26 +59,56 @@ # Finds the least covered file and returns that file's name def least_covered_file - sort_by(&:covered_percent).first.filename + min_by(&:covered_percent).filename end # Returns the overall amount of relevant lines of code across all files in this list def lines_of_code - covered_lines + missed_lines + coverage_statistics:line&.total end # Computes the coverage based upon lines covered and lines missed # @return Float def covered_percent - return 100.0 if empty? || lines_of_code.zero? - Float(covered_lines * 100.0 / lines_of_code) + coverage_statistics:line&.percent end # Computes the strength (hits / line) based upon lines covered and lines missed # @return Float def covered_strength - return 0.0 if empty? || lines_of_code.zero? - Float(map { |f| f.covered_strength * f.lines_of_code }.inject(&:+) / lines_of_code) + coverage_statistics:line&.strength + end + + # Return total count of branches in all files + def total_branches + coverage_statistics:branch&.total + end + + # Return total count of covered branches + def covered_branches + coverage_statistics:branch&.covered + end + + # Return total count of covered branches + def missed_branches + coverage_statistics:branch&.missed + end + + def branch_covered_percent + coverage_statistics:branch&.percent + end + + private + + def compute_coverage_statistics + total_coverage_statistics = @files.each_with_object(line: , branch: ) do |file, together| + together:line << file.coverage_statistics:line + together:branch << file.coverage_statistics:branch if SimpleCov.branch_coverage? + end + + coverage_statistics = {line: CoverageStatistics.from(total_coverage_statistics:line)} + coverage_statistics:branch = CoverageStatistics.from(total_coverage_statistics:branch) if SimpleCov.branch_coverage? + coverage_statistics end end end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/filter.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/filter.rb
Changed
@@ -1,3 +1,5 @@ +# frozen_string_literal: true + module SimpleCov # # Base filter class. Inherit from this to create custom filters, @@ -12,11 +14,12 @@ # class Filter attr_reader :filter_argument + def initialize(filter_argument) @filter_argument = filter_argument end - def matches?(_) + def matches?(_source_file) raise "The base filter class is not intended for direct use" end @@ -24,13 +27,42 @@ warn "#{Kernel.caller.first}: DEPRECATION #passes? is deprecated. Use #matches? instead." matches?(source_file) end + + def self.build_filter(filter_argument) + return filter_argument if filter_argument.is_a?(SimpleCov::Filter) + + class_for_argument(filter_argument).new(filter_argument) + end + + def self.class_for_argument(filter_argument) + case filter_argument + when String + SimpleCov::StringFilter + when Regexp + SimpleCov::RegexFilter + when Array + SimpleCov::ArrayFilter + when Proc + SimpleCov::BlockFilter + else + raise ArgumentError, "You have provided an unrecognized filter type" + end + end end class StringFilter < SimpleCov::Filter # Returns true when the given source file's filename matches the - # string configured when initializing this Filter with StringFilter.new('somestring) + # string configured when initializing this Filter with StringFilter.new('somestring') + def matches?(source_file) + source_file.project_filename.include?(filter_argument) + end + end + + class RegexFilter < SimpleCov::Filter + # Returns true when the given source file's filename matches the + # regex configured when initializing this Filter with RegexFilter.new(/someregex/) def matches?(source_file) - (source_file.filename =~ /#{filter_argument}/) + (source_file.project_filename =~ filter_argument) end end @@ -43,11 +75,19 @@ end class ArrayFilter < SimpleCov::Filter - # Returns true if any of the file paths passed in the given array matches the string - # configured when initializing this Filter with StringFilter.new('some/path', 'other/path') + def initialize(filter_argument) + filter_objects = filter_argument.map do |arg| + Filter.build_filter(arg) + end + + super(filter_objects) + end + + # Returns true if any of the filters in the array match the given source file. + # Configure this Filter like StringFilter.new('some/path', /^some_regex/, Proc.new {|src_file| ... }) def matches?(source_files_list) filter_argument.any? do |arg| - source_files_list.filename =~ /#{arg}/ + arg.matches?(source_files_list) end end end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/formatter.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/formatter.rb
Changed
@@ -1,8 +1,10 @@ +# frozen_string_literal: true + module SimpleCov # TODO: Documentation on how to build your own formatters module Formatter end end -require "simplecov/formatter/simple_formatter" -require "simplecov/formatter/multi_formatter" +require_relative "formatter/simple_formatter" +require_relative "formatter/multi_formatter"
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/formatter/multi_formatter.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/formatter/multi_formatter.rb
Changed
@@ -1,15 +1,15 @@ +# frozen_string_literal: true + module SimpleCov module Formatter class MultiFormatter module InstanceMethods def format(result) formatters.map do |formatter| - begin - formatter.new.format(result) - rescue => e - STDERR.puts("Formatter #{formatter} failed with #{e.class}: #{e.message} (#{e.backtrace.first})") - nil - end + formatter.new.format(result) + rescue StandardError => e + warn("Formatter #{formatter} failed with #{e.class}: #{e.message} (#{e.backtrace.first})") + nil end end end @@ -25,7 +25,7 @@ def self.(*args) warn "#{Kernel.caller.first}: DEPRECATION :: is deprecated. Use ::new instead." - new(Array(*args)) + new(Array(args)) end end end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/formatter/simple_formatter.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/formatter/simple_formatter.rb
Changed
@@ -1,12 +1,14 @@ -# -# A ridiculously simple formatter for SimpleCov results. -# +# frozen_string_literal: true + module SimpleCov module Formatter + # + # A ridiculously simple formatter for SimpleCov results. + # class SimpleFormatter # Takes a SimpleCov::Result and generates a string out of it def format(result) - output = "" + output = +"" result.groups.each do |name, files| output << "Group: #{name}\n" output << "=" * 40
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/last_run.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/last_run.rb
Changed
@@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "json" module SimpleCov @@ -9,7 +11,11 @@ def read return nil unless File.exist?(last_run_path) - JSON.parse(File.read(last_run_path)) + + json = File.read(last_run_path) + return nil if json.strip.empty? + + JSON.parse(json, symbolize_names: true) end def write(json)
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/lines_classifier.rb
Added
@@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module SimpleCov + # Classifies whether lines are relevant for code coverage analysis. + # Comments & whitespace lines, and :nocov: token blocks, are considered not relevant. + + class LinesClassifier + RELEVANT = 0 + NOT_RELEVANT = nil + + WHITESPACE_LINE = /^\s*$/.freeze + COMMENT_LINE = /^\s*#/.freeze + WHITESPACE_OR_COMMENT_LINE = Regexp.union(WHITESPACE_LINE, COMMENT_LINE) + + def self.no_cov_line + /^(\s*)#(\s*)(:#{SimpleCov.nocov_token}:)/o + end + + def self.no_cov_line?(line) + line =~ no_cov_line + rescue ArgumentError + # E.g., line contains an invalid byte sequence in UTF-8 + false + end + + def self.whitespace_line?(line) + line =~ WHITESPACE_OR_COMMENT_LINE + rescue ArgumentError + # E.g., line contains an invalid byte sequence in UTF-8 + false + end + + def classify(lines) + skipping = false + + lines.map do |line| + if self.class.no_cov_line?(line) + skipping = !skipping + NOT_RELEVANT + elsif skipping || self.class.whitespace_line?(line) + NOT_RELEVANT + else + RELEVANT + end + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/load_global_config.rb
Added
@@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require "etc" +home_dir = (ENV"HOME" && File.expand_path("~")) || Etc.getpwuid.dir || (ENV"USER" && File.expand_path("~#{ENV'USER'}")) +if home_dir + global_config_path = File.join(home_dir, ".simplecov") + load global_config_path if File.exist?(global_config_path) +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/no_defaults.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/no_defaults.rb
Changed
@@ -1,2 +1,4 @@ +# frozen_string_literal: true + ENV"SIMPLECOV_NO_DEFAULTS" = "yes, no defaults" -require "simplecov" +require_relative "../simplecov"
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/process.rb
Added
@@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Process + class << self + def fork_with_simplecov(&block) + if defined?(SimpleCov) && SimpleCov.running + fork_without_simplecov do + SimpleCov.at_fork.call(Process.pid) + block.call if block_given? + end + else + fork_without_simplecov(&block) + end + end + + alias fork_without_simplecov fork + alias fork fork_with_simplecov + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/profiles.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/profiles.rb
Changed
@@ -1,11 +1,13 @@ -# -# Profiles are SimpleCov configuration procs that can be easily -# loaded using SimpleCov.start :rails and defined using -# SimpleCov.profiles.define :foo do -# # SimpleCov configuration here, same as in SimpleCov.configure -# end -# +# frozen_string_literal: true + module SimpleCov + # + # Profiles are SimpleCov configuration procs that can be easily + # loaded using SimpleCov.start :rails and defined using + # SimpleCov.profiles.define :foo do + # # SimpleCov configuration here, same as in SimpleCov.configure + # end + # class Profiles < Hash # # Define a SimpleCov profile: @@ -16,6 +18,7 @@ def define(name, &blk) name = name.to_sym raise "SimpleCov Profile '#{name}' is already defined" unless selfname.nil? + selfname = blk end @@ -25,6 +28,7 @@ def load(name) name = name.to_sym raise "Could not find SimpleCov Profile called '#{name}'" unless key?(name) + SimpleCov.configure(&selfname) end end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/profiles/bundler_filter.rb
Added
@@ -0,0 +1,5 @@ +# frozen_string_literal: true + +SimpleCov.profiles.define "bundler_filter" do + add_filter "/vendor/bundle/" +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/profiles/hidden_filter.rb
Added
@@ -0,0 +1,5 @@ +# frozen_string_literal: true + +SimpleCov.profiles.define "hidden_filter" do + add_filter %r{^/\..*} +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/profiles/rails.rb
Added
@@ -0,0 +1,18 @@ +# frozen_string_literal: true + +SimpleCov.profiles.define "rails" do + load_profile "test_frameworks" + + add_filter %r{^/config/} + add_filter %r{^/db/} + + add_group "Controllers", "app/controllers" + add_group "Channels", "app/channels" + add_group "Models", "app/models" + add_group "Mailers", "app/mailers" + add_group "Helpers", "app/helpers" + add_group "Jobs", %wapp/jobs app/workers + add_group "Libraries", "lib/" + + track_files "{app,lib}/**/*.rb" +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/profiles/root_filter.rb
Added
@@ -0,0 +1,10 @@ +# frozen_string_literal: true + +SimpleCov.profiles.define "root_filter" do + # Exclude all files outside of simplecov root + root_filter = nil + add_filter do |src| + root_filter ||= /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/io + src.filename !~ root_filter + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/profiles/test_frameworks.rb
Added
@@ -0,0 +1,8 @@ +# frozen_string_literal: true + +SimpleCov.profiles.define "test_frameworks" do + add_filter "/test/" + add_filter "/features/" + add_filter "/spec/" + add_filter "/autotest/" +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/result.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/result.rb
Changed
@@ -1,9 +1,11 @@ +# frozen_string_literal: true + require "digest/sha1" require "forwardable" module SimpleCov # - # A simplecov code coverage result, initialized from the Hash Ruby 1.9's built-in coverage + # A simplecov code coverage result, initialized from the Hash Ruby's built-in coverage # library generates (Coverage.result). # class Result @@ -18,16 +20,18 @@ # Explicitly set the command name that was used for this coverage result. Defaults to SimpleCov.command_name attr_writer :command_name - def_delegators :files, :covered_percent, :covered_percentages, :least_covered_file, :covered_strength, :covered_lines, :missed_lines + def_delegators :files, :covered_percent, :covered_percentages, :least_covered_file, :covered_strength, :covered_lines, :missed_lines, :total_branches, :covered_branches, :missed_branches, :coverage_statistics def_delegator :files, :lines_of_code, :total_lines # Initialize a new SimpleCov::Result from given Coverage.result (a Hash of filenames each containing an array of # coverage data) - def initialize(original_result) - original_result = original_result.dup.extend(SimpleCov::HashMergeHelper) unless original_result.is_a? SimpleCov::HashMergeHelper - @original_result = original_result.freeze - @files = SimpleCov::FileList.new(original_result.map do |filename, coverage| - SimpleCov::SourceFile.new(filename, coverage) if File.file?(filename) + def initialize(original_result, command_name: nil, created_at: nil) + result = adapt_result(original_result) + @original_result = result.freeze + @command_name = command_name + @created_at = created_at + @files = SimpleCov::FileList.new(result.map do |filename, coverage| + SimpleCov::SourceFile.new(filename, JSON.parse(JSON.dump(coverage))) if File.file?(filename) end.compact.sort_by(&:filename)) filter! end @@ -60,20 +64,52 @@ # Returns a hash representation of this Result that can be used for marshalling it into JSON def to_hash - {command_name => {"coverage" => coverage, "timestamp" => created_at.to_i}} + { + command_name => { + "coverage" => coverage, + "timestamp" => created_at.to_i + } + } + end + + def time_since_creation + Time.now - created_at end # Loads a SimpleCov::Result#to_hash dump def self.from_hash(hash) - command_name, data = hash.first - result = SimpleCov::Result.new(data"coverage") - result.command_name = command_name - result.created_at = Time.at(data"timestamp") - result + hash.map do |command_name, data| + new(data.fetch("coverage"), command_name: command_name, created_at: Time.at(data"timestamp")) + end end private + # We changed the format of the raw result data in simplecov, as people are likely + # to have "old" resultsets lying around (but not too old so that they're still + # considered we can adapt them). + # See https://github.com/simplecov-ruby/simplecov/pull/824#issuecomment-576049747 + def adapt_result(result) + if pre_simplecov_0_18_result?(result) + adapt_pre_simplecov_0_18_result(result) + else + result + end + end + + # pre 0.18 coverage data pointed from file directly to an array of line coverage + def pre_simplecov_0_18_result?(result) + _key, data = result.first + + data.is_a?(Array) + end + + def adapt_pre_simplecov_0_18_result(result) + result.transform_values do |line_coverage_data| + {"lines" => line_coverage_data} + end + end + def coverage keys = original_result.keys & filenames Hashkeys.zip(original_result.values_at(*keys))
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/result_adapter.rb
Added
@@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module SimpleCov + # + # Responsible for adapting the format of the coverage result whether it's default or with statistics + # + class ResultAdapter + attr_reader :result + + def initialize(result) + @result = result + end + + def self.call(*args) + new(*args).adapt + end + + def adapt + return unless result + + result.each_with_object({}) do |(file_name, cover_statistic), adapted_result| + if cover_statistic.is_a?(Array) + adapted_result.merge!(file_name => {"lines" => cover_statistic}) + else + adapted_result.merge!(file_name => cover_statistic) + end + end + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/result_merger.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/result_merger.rb
Changed
@@ -1,11 +1,13 @@ +# frozen_string_literal: true + require "json" -# -# Singleton that is responsible for caching, loading and merging -# SimpleCov::Results into a single result for coverage analysis based -# upon multiple test suites. -# module SimpleCov + # + # Singleton that is responsible for caching, loading and merging + # SimpleCov::Results into a single result for coverage analysis based + # upon multiple test suites. + # module ResultMerger class << self # The path to the .resultset.json cache file @@ -17,25 +19,33 @@ File.join(SimpleCov.coverage_path, ".resultset.json.lock") end - # Loads the cached resultset from JSON and returns it as a Hash + # Loads the cached resultset from JSON and returns it as a Hash, + # caching it for subsequent accesses. def resultset - if stored_data - begin - JSON.parse(stored_data) - rescue + @resultset ||= begin + data = stored_data + if data + begin + JSON.parse(data) || {} + rescue StandardError + {} + end + else {} end - else - {} end end # Returns the contents of the resultset cache as a string or if the file is missing or empty nil def stored_data - return unless File.exist?(resultset_path) - data = File.read(resultset_path) - return if data.nil? || data.length < 2 - data + synchronize_resultset do + return unless File.exist?(resultset_path) + + data = File.read(resultset_path) + return if data.nil? || data.length < 2 + + data + end end # Gets the resultset hash and re-creates all included instances @@ -43,15 +53,26 @@ # All results that are above the SimpleCov.merge_timeout will be # dropped. Returns an array of SimpleCov::Result items. def results - results = - resultset.each do |command_name, data| - result = SimpleCov::Result.from_hash(command_name => data) - # Only add result if the timeout is above the configured threshold - if (Time.now - result.created_at) < SimpleCov.merge_timeout - results << result - end - end - results + results = Result.from_hash(resultset) + results.select { |result| result.time_since_creation < SimpleCov.merge_timeout } + end + + def merge_and_store(*results) + result = merge_results(*results) + store_result(result) if result + result + end + + # Merge two or more SimpleCov::Results into a new one with merged + # coverage data and the command_name for the result consisting of a join + # on all source result's names + def merge_results(*results) + parsed_results = JSON.parse(JSON.dump(results.map(&:original_result))) + combined_result = SimpleCov::Combine::ResultsCombiner.combine(*parsed_results) + result = SimpleCov::Result.new(combined_result) + # Specify the command name + result.command_name = results.map(&:command_name).sort.join(", ") + result end # @@ -60,20 +81,14 @@ # for the result consisting of a join on all source result's names # def merged_result - merged = {} - results.each do |result| - merged = result.original_result.merge_resultset(merged) - end - result = SimpleCov::Result.new(merged) - # Specify the command name - result.command_name = results.map(&:command_name).sort.join(", ") - result + merge_results(*results) end # Saves the given SimpleCov::Result in the resultset cache def store_result(result) - File.open(resultset_writelock, "w+") do |f| - f.flock(File::LOCK_EX) + synchronize_resultset do + # Ensure we have the latest, in case it was already cached + clear_resultset new_set = resultset command_name, data = result.to_hash.first new_setcommand_name = data @@ -83,6 +98,28 @@ end true end + + # Ensure only one process is reading or writing the resultset at any + # given time + def synchronize_resultset + # make it reentrant + return yield if defined?(@resultset_locked) && @resultset_locked + + begin + @resultset_locked = true + File.open(resultset_writelock, "w+") do |f| + f.flock(File::LOCK_EX) + yield + end + ensure + @resultset_locked = false + end + end + + # Clear out the previously cached .resultset + def clear_resultset + @resultset = nil + end end end end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/simulate_coverage.rb
Added
@@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module SimpleCov + # + # Responsible for producing file coverage metrics. + # + module SimulateCoverage + module_function + + # + # Simulate normal file coverage report on + # ruby 2.5 and return similar hash with lines and branches keys + # + # Happens when a file wasn't required but still tracked. + # + # @return Hash + # + def call(absolute_path) + lines = File.foreach(absolute_path) + + { + "lines" => LinesClassifier.new.classify(lines), + # we don't want to parse branches ourselves... + # requiring files can have side effects and we don't want to trigger that + "branches" => {} + } + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/source_file.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/source_file.rb
Changed
@@ -1,147 +1,49 @@ +# frozen_string_literal: true + module SimpleCov # # Representation of a source file including it's coverage data, source code, # source lines and featuring helpers to interpret that data. # class SourceFile - # Representation of a single line in a source file including - # this specific line's source code, line_number and code coverage, - # with the coverage being either nil (coverage not applicable, e.g. comment - # line), 0 (line not covered) or >1 (the amount of times the line was - # executed) - class Line - # The source code for this line. Aliased as :source - attr_reader :src - # The line number in the source file. Aliased as :line, :number - attr_reader :line_number - # The coverage data for this line: either nil (never), 0 (missed) or >=1 (times covered) - attr_reader :coverage - # Whether this line was skipped - attr_reader :skipped - - # Lets grab some fancy aliases, shall we? - alias source src - alias line line_number - alias number line_number - - def initialize(src, line_number, coverage) - raise ArgumentError, "Only String accepted for source" unless src.is_a?(String) - raise ArgumentError, "Only Integer accepted for line_number" unless line_number.is_a?(Integer) - raise ArgumentError, "Only Integer and nil accepted for coverage" unless coverage.is_a?(Integer) || coverage.nil? - @src = src - @line_number = line_number - @coverage = coverage - @skipped = false - end - - # Returns true if this is a line that should have been covered, but was not - def missed? - !never? && !skipped? && coverage.zero? - end - - # Returns true if this is a line that has been covered - def covered? - !never? && !skipped? && coverage > 0 - end - - # Returns true if this line is not relevant for coverage - def never? - !skipped? && coverage.nil? - end - - # Flags this line as skipped - def skipped! - @skipped = true - end - - # Returns true if this line was skipped, false otherwise. Lines are skipped if they are wrapped with - # # :nocov: comment lines. - def skipped? - !!skipped - end - - # The status of this line - either covered, missed, skipped or never. Useful i.e. for direct use - # as a css class in report generation - def status - return "skipped" if skipped? - return "never" if never? - return "missed" if missed? - return "covered" if covered? - end - end - # The full path to this source file (e.g. /User/colszowka/projects/simplecov/lib/simplecov/source_file.rb) attr_reader :filename # The array of coverage data received from the Coverage.result - attr_reader :coverage + attr_reader :coverage_data - def initialize(filename, coverage) + def initialize(filename, coverage_data) @filename = filename - @coverage = coverage + @coverage_data = coverage_data + end + + # The path to this source file relative to the projects directory + def project_filename + @filename.sub(Regexp.new("^#{Regexp.escape(SimpleCov.root)}"), "") end # The source code for this file. Aliased as :source def src # We intentionally read source code lazily to # suppress reading unused source code. - @src ||= File.open(filename, "rb", &:readlines) + @src ||= load_source end alias source src + def coverage_statistics + @coverage_statistics ||= + { + **line_coverage_statistics, + **branch_coverage_statistics + } + end + # Returns all source lines for this file as instances of SimpleCov::SourceFile::Line, # and thus including coverage data. Aliased as :source_lines def lines - return @lines if defined? @lines - - # Warning to identify condition from Issue #56 - if coverage.size > src.size - $stderr.puts "Warning: coverage data provided by Coverage #{coverage.size} exceeds number of lines in #{filename} #{src.size}" - end - - # Initialize lines - @lines = - src.each_with_index do |src, i| - @lines << SimpleCov::SourceFile::Line.new(src, i + 1, coveragei) - end - process_skipped_lines! - @lines + @lines ||= build_lines end alias source_lines lines - # Access SimpleCov::SourceFile::Line source lines by line number - def line(number) - linesnumber - 1 - end - - # The coverage for this file in percent. 0 if the file has no relevant lines - def covered_percent - return 100.0 if lines.length.zero? || lines.length == never_lines.count - relevant_lines = lines.count - never_lines.count - skipped_lines.count - if relevant_lines.zero? - 0.0 - else - Float(covered_lines.count * 100.0 / relevant_lines.to_f) - end - end - - def covered_strength - return 0.0 if lines.length.zero? || lines.length == never_lines.count - - lines_strength = 0 - lines.each do |c| - lines_strength += c.coverage if c.coverage - end - - effective_lines_count = Float(lines.count - never_lines.count - skipped_lines.count) - - if effective_lines_count.zero? - 0.0 - else - strength = lines_strength / effective_lines_count - round_float(strength, 1) - end - end - # Returns all covered lines as SimpleCov::SourceFile::Line def covered_lines @covered_lines ||= lines.select(&:covered?) @@ -166,29 +68,282 @@ # Returns the number of relevant lines (covered + missed) def lines_of_code - covered_lines.count + missed_lines.count - end - - # Will go through all source files and mark lines that are wrapped within # :nocov: comment blocks - # as skipped. - def process_skipped_lines! - skipping = false - lines.each do |line| - if line.src =~ /^(\s*)#(\s*)(\:#{SimpleCov.nocov_token}\:)/ - skipping = !skipping - elsif skipping - line.skipped! + coverage_statistics:line&.total + end + + # Access SimpleCov::SourceFile::Line source lines by line number + def line(number) + linesnumber - 1 + end + + # The coverage for this file in percent. 0 if the file has no coverage lines + def covered_percent + coverage_statistics:line&.percent + end + + def covered_strength + coverage_statistics:line&.strength + end + + def no_lines? + lines.length.zero? || (lines.length == never_lines.size) + end + + def relevant_lines + lines.size - never_lines.size - skipped_lines.size + end + + # + # Return all the branches inside current source file + def branches + @branches ||= build_branches + end + + def no_branches? + total_branches.empty? + end + + def branches_coverage_percent + coverage_statistics:branch&.percent + end + + # + # Return the relevant branches to source file + def total_branches + @total_branches ||= covered_branches + missed_branches + end + + # + # Return hash with key of line number and branch coverage count as value + def branches_report + @branches_report ||= build_branches_report + end + + # + # Select the covered branches + # Here we user tree schema because some conditions like case may have additional + # else that is not in declared inside the code but given by default by coverage report + # + # @return Array + # + def covered_branches + @covered_branches ||= branches.select(&:covered?) + end + + # + # Select the missed branches with coverage equal to zero + # + # @return Array + # + def missed_branches + @missed_branches ||= branches.select(&:missed?) + end + + def branches_for_line(line_number) + branches_report.fetch(line_number, ) + end + + # + # Check if any branches missing on given line number + # + # @param Integer line_number + # + # @return Boolean + # + def line_with_missed_branch?(line_number) + branches_for_line(line_number).select { |_type, count| count.zero? }.any? + end + + private + + # no_cov_chunks is zero indexed to work directly with the array holding the lines + def no_cov_chunks + @no_cov_chunks ||= build_no_cov_chunks + end + + def build_no_cov_chunks + no_cov_lines = src.map.with_index(1).select { |line_src, _index| LinesClassifier.no_cov_line?(line_src) } + + # if we have an uneven number of nocovs we assume they go to the + # end of the file, the source doesn't really matter + # Can't deal with this within the each_slice due to differing + # behavior in JRuby: jruby/jruby#6048 + no_cov_lines << "", src.size if no_cov_lines.size.odd? + + no_cov_lines.each_slice(2).map do |(_line_src_start, index_start), (_line_src_end, index_end)| + index_start..index_end + end + end + + def load_source + lines = + # The default encoding is UTF-8 + File.open(filename, "rb:UTF-8") do |file| + current_line = file.gets + + if shebang?(current_line) + lines << current_line + current_line = file.gets end + + read_lines(file, lines, current_line) end end - private + SHEBANG_REGEX = /\A#!/.freeze + def shebang?(line) + SHEBANG_REGEX.match?(line) + end + + def read_lines(file, lines, current_line) + return lines unless current_line + + set_encoding_based_on_magic_comment(file, current_line) + lines.concat(current_line, ensure_remove_undefs(file.readlines)) + end + + RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX = /\A#\s*(?:-\*-)?\s*(?:en)?coding:\s*(\S+)\s*(?:-\*-)?\s*\z/.freeze + def set_encoding_based_on_magic_comment(file, line) + # Check for encoding magic comment + # Encoding magic comment must be placed at first line except for shebang + if (match = RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX.match(line)) + file.set_encoding(match1, "UTF-8") + end + end + + def ensure_remove_undefs(file_lines) + # invalid/undef replace are technically not really necessary but nice to + # have and work around a JRuby incompatibility. Also moved here from + # simplecov-html to have encoding shenaningans in one place. See #866 + # also setting these option on `file.set_encoding` doesn't seem to work + # properly so it has to be done here. + file_lines.each { |line| line.encode!("UTF-8", invalid: :replace, undef: :replace) } + end + + def build_lines + coverage_exceeding_source_warn if coverage_data"lines".size > src.size + lines = src.map.with_index(1) do |src, i| + SimpleCov::SourceFile::Line.new(src, i, coverage_data"lines"i - 1) + end + process_skipped_lines(lines) + end + + def process_skipped_lines(lines) + # the array the lines are kept in is 0-based whereas the line numbers in the nocov + # chunks are 1-based and are expected to be like this in other parts (and it's also + # arguably more understandable) + no_cov_chunks.each { |chunk| lines(chunk.begin - 1)..(chunk.end - 1).each(&:skipped!) } + + lines + end + + def lines_strength + lines.map(&:coverage).compact.reduce(:+) + end + + # Warning to identify condition from Issue #56 + def coverage_exceeding_source_warn + warn "Warning: coverage data provided by Coverage #{coverage_data'lines'.size} exceeds number of lines in #{filename} #{src.size}" + end + + # + # Build full branches report + # Root branches represent the wrapper of all condition state that + # have inside the branches + # + # @return Hash + # + def build_branches_report + branches.reject(&:skipped?).each_with_object({}) do |branch, coverage_statistics| + coverage_statisticsbranch.report_line ||= + coverage_statisticsbranch.report_line << branch.report + end + end + + # + # Call recursive method that transform our static hash to array of objects + # @return Array + # + def build_branches + coverage_branch_data = coverage_data.fetch("branches", {}) + branches = coverage_branch_data.flat_map do |condition, coverage_branches| + build_branches_from(condition, coverage_branches) + end + + process_skipped_branches(branches) + end + + def process_skipped_branches(branches) + return branches if no_cov_chunks.empty? + + branches.each do |branch| + branch.skipped! if no_cov_chunks.any? { |no_cov_chunk| branch.overlaps_with?(no_cov_chunk) } + end + + branches + end + + # Since we are dumping to and loading from JSON, and we have arrays as keys those + # don't make their way back to us intact e.g. just as a string + # + # We should probably do something different here, but as it stands these are + # our data structures that we write so eval isn't _too_ bad. + # + # See #801 + # + def restore_ruby_data_structure(structure) + # Tests use the real data structures (except for integration tests) so no need to + # put them through here. + return structure if structure.is_a?(Array) + + # rubocop:disable Security/Eval + eval structure + # rubocop:enable Security/Eval + end + + def build_branches_from(condition, branches) + # the format handed in from the coverage data is like this: + # + # :then, 4, 6, 6, 6, 10 + # + # which is type, id, start_line, start_col, end_line, end_col + _condition_type, _condition_id, condition_start_line, * = restore_ruby_data_structure(condition) + + branches.map do |branch_data, hit_count| + branch_data = restore_ruby_data_structure(branch_data) + build_branch(branch_data, hit_count, condition_start_line) + end + end + + def build_branch(branch_data, hit_count, condition_start_line) + type, _id, start_line, _start_col, end_line, _end_col = branch_data + + SourceFile::Branch.new( + start_line: start_line, + end_line: end_line, + coverage: hit_count, + inline: start_line == condition_start_line, + type: type + ) + end + + def line_coverage_statistics + { + line: CoverageStatistics.new( + total_strength: lines_strength, + covered: covered_lines.size, + missed: missed_lines.size + ) + } + end - # ruby 1.9 could use Float#round(places) instead - # @return Float - def round_float(float, places) - factor = Float(10 * places) - Float((float * factor).round / factor) + def branch_coverage_statistics + { + branch: CoverageStatistics.new( + covered: covered_branches.size, + missed: missed_branches.size + ) + } end end end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/source_file/branch.rb
Added
@@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module SimpleCov + class SourceFile + # + # Representing single branch that has been detected in coverage report. + # Give us support methods that handle needed calculations. + class Branch + attr_reader :start_line, :end_line, :coverage, :type + + # rubocop:disable Metrics/ParameterLists + def initialize(start_line:, end_line:, coverage:, inline:, type:) + @start_line = start_line + @end_line = end_line + @coverage = coverage + @inline = inline + @type = type + @skipped = false + end + # rubocop:enable Metrics/ParameterLists + + def inline? + @inline + end + + # + # Return true if there is relevant count defined > 0 + # + # @return Boolean + # + def covered? + !skipped? && coverage.positive? + end + + # + # Check if branche missed or not + # + # @return Boolean + # + def missed? + !skipped? && coverage.zero? + end + + # The line on which we want to report the coverage + # + # Usually we choose the line above the start of the branch (so that it shows up + # at if/else) because that + # * highlights the condition + # * makes it distinguishable if the first line of the branch is an inline branch + # (see the nested_branches fixture) + # + def report_line + if inline? + start_line + else + start_line - 1 + end + end + + # Flags the branch as skipped + def skipped! + @skipped = true + end + + # Returns true if the branch was marked skipped by virtue of nocov comments. + def skipped? + @skipped + end + + def overlaps_with?(line_range) + start_line <= line_range.end && end_line >= line_range.begin + end + + # + # Return array with coverage count and badge + # + # @return Array + # + def report + type, coverage + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/source_file/line.rb
Added
@@ -0,0 +1,72 @@ +# frozen_string_literal: true + +module SimpleCov + class SourceFile + # Representation of a single line in a source file including + # this specific line's source code, line_number and code coverage, + # with the coverage being either nil (coverage not applicable, e.g. comment + # line), 0 (line not covered) or >1 (the amount of times the line was + # executed) + class Line + # The source code for this line. Aliased as :source + attr_reader :src + # The line number in the source file. Aliased as :line, :number + attr_reader :line_number + # The coverage data for this line: either nil (never), 0 (missed) or >=1 (times covered) + attr_reader :coverage + # Whether this line was skipped + attr_reader :skipped + + # Lets grab some fancy aliases, shall we? + alias source src + alias line line_number + alias number line_number + + def initialize(src, line_number, coverage) + raise ArgumentError, "Only String accepted for source" unless src.is_a?(String) + raise ArgumentError, "Only Integer accepted for line_number" unless line_number.is_a?(Integer) + raise ArgumentError, "Only Integer and nil accepted for coverage" unless coverage.is_a?(Integer) || coverage.nil? + + @src = src + @line_number = line_number + @coverage = coverage + @skipped = false + end + + # Returns true if this is a line that should have been covered, but was not + def missed? + !never? && !skipped? && coverage.zero? + end + + # Returns true if this is a line that has been covered + def covered? + !never? && !skipped? && coverage.positive? + end + + # Returns true if this line is not relevant for coverage + def never? + !skipped? && coverage.nil? + end + + # Flags this line as skipped + def skipped! + @skipped = true + end + + # Returns true if this line was skipped, false otherwise. Lines are skipped if they are wrapped with + # # :nocov: comment lines. + def skipped? + !!skipped + end + + # The status of this line - either covered, missed, skipped or never. Useful i.e. for direct use + # as a css class in report generation + def status + return "skipped" if skipped? + return "never" if never? + return "missed" if missed? + return "covered" if covered? + end + end + end +end
View file
_service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/useless_results_remover.rb
Added
@@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module SimpleCov + # + # Select the files that related to working scope directory of SimpleCov + # + module UselessResultsRemover + def self.call(coverage_result) + coverage_result.select do |path, _coverage| + path =~ root_regx + end + end + + def self.root_regx + @root_regx ||= /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/i.freeze + end + end +end
View file
_service:tar_scm:simplecov-0.13.0.gem/data/lib/simplecov/version.rb -> _service:tar_scm:simplecov-0.19.1.gem/data/lib/simplecov/version.rb
Changed
@@ -1,25 +1,5 @@ -module SimpleCov - version = "0.13.0" - - def version.to_a - split(".").map(&:to_i) - end - - def version.major - to_a0 - end - - def version.minor - to_a1 - end +# frozen_string_literal: true - def version.patch - to_a2 - end - - def version.pre - to_a3 - end - - VERSION = version +module SimpleCov + VERSION = "0.19.1" end
View file
_service:tar_scm:simplecov-0.13.0.gem/metadata.gz -> _service:tar_scm:simplecov-0.19.1.gem/metadata.gz
Changed
@@ -1,204 +1,112 @@ --- !ruby/object:Gem::Specification name: simplecov version: !ruby/object:Gem::Version - version: 0.13.0 + version: 0.19.1 platform: ruby authors: - Christoph Olszowka +- Tobias Pfeiffer autorequire: bindir: bin cert_chain: -date: 2017-01-25 00:00:00.000000000 Z +date: 2020-10-25 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency - name: json - requirement: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: '1.8' - - - "<" - - !ruby/object:Gem::Version - version: '3' - type: :runtime - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: '1.8' - - - "<" - - !ruby/object:Gem::Version - version: '3' -- !ruby/object:Gem::Dependency - name: simplecov-html - requirement: !ruby/object:Gem::Requirement - requirements: - - - "~>" - - !ruby/object:Gem::Version - version: 0.10.0 - type: :runtime - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - "~>" - - !ruby/object:Gem::Version - version: 0.10.0 -- !ruby/object:Gem::Dependency name: docile requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: 1.1.0 + version: '1.1' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: 1.1.0 + version: '1.1' - !ruby/object:Gem::Dependency - name: bundler + name: simplecov-html requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.9' - type: :development + version: '0.11' + type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '1.9' -description: Code coverage for Ruby 1.9+ with a powerful configuration library and - automatic merging of coverage across test suites + version: '0.11' +description: Code coverage for Ruby with a powerful configuration library and automatic + merging of coverage across test suites email: - christoph at olszowka de +- pragtob@gmail.com executables: extensions: extra_rdoc_files: files: -- ".gitignore" -- ".rspec" -- ".rubocop.yml" -- ".travis.yml" -- ".yardopts" - CHANGELOG.md +- CODE_OF_CONDUCT.md - CONTRIBUTING.md -- Gemfile -- MIT-LICENSE +- ISSUE_TEMPLATE.md +- LICENSE - README.md -- Rakefile -- cucumber.yml - doc/alternate-formatters.md - doc/commercial-services.md - doc/editor-integration.md -- features/config_autoload.feature -- features/config_command_name.feature -- features/config_coverage_dir.feature -- features/config_deactivate_merging.feature -- features/config_formatters.feature -- features/config_merge_timeout.feature -- features/config_nocov_token.feature -- features/config_profiles.feature -- features/config_project_name.feature -- features/config_styles.feature -- features/config_tracked_files.feature -- features/cucumber_basic.feature -- features/maximum_coverage_drop.feature -- features/merging_test_unit_and_rspec.feature -- features/minimum_coverage.feature -- features/refuse_coverage_drop.feature -- features/rspec_basic.feature -- features/rspec_fails_on_initialization.feature -- features/rspec_groups_and_filters_basic.feature -- features/rspec_groups_and_filters_complex.feature -- features/rspec_groups_using_filter_class.feature -- features/rspec_without_simplecov.feature -- features/skipping_code_blocks_manually.feature -- features/step_definitions/html_steps.rb -- features/step_definitions/simplecov_steps.rb -- features/step_definitions/transformers.rb -- features/step_definitions/web_steps.rb -- features/support/env.rb -- features/test_unit_basic.feature -- features/test_unit_groups_and_filters_basic.feature -- features/test_unit_groups_and_filters_complex.feature -- features/test_unit_groups_using_filter_class.feature -- features/test_unit_without_simplecov.feature -- features/unicode_compatiblity.feature +- lib/minitest/simplecov_plugin.rb - lib/simplecov.rb +- lib/simplecov/combine.rb +- lib/simplecov/combine/branches_combiner.rb +- lib/simplecov/combine/files_combiner.rb +- lib/simplecov/combine/lines_combiner.rb +- lib/simplecov/combine/results_combiner.rb - lib/simplecov/command_guesser.rb - lib/simplecov/configuration.rb +- lib/simplecov/coverage_statistics.rb - lib/simplecov/defaults.rb - lib/simplecov/exit_codes.rb +- lib/simplecov/exit_codes/exit_code_handling.rb +- lib/simplecov/exit_codes/maximum_coverage_drop_check.rb +- lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb +- lib/simplecov/exit_codes/minimum_overall_coverage_check.rb - lib/simplecov/file_list.rb - lib/simplecov/filter.rb - lib/simplecov/formatter.rb - lib/simplecov/formatter/multi_formatter.rb - lib/simplecov/formatter/simple_formatter.rb -- lib/simplecov/jruby_fix.rb - lib/simplecov/last_run.rb -- lib/simplecov/merge_helpers.rb +- lib/simplecov/lines_classifier.rb +- lib/simplecov/load_global_config.rb - lib/simplecov/no_defaults.rb +- lib/simplecov/process.rb - lib/simplecov/profiles.rb -- lib/simplecov/railtie.rb -- lib/simplecov/railties/tasks.rake +- lib/simplecov/profiles/bundler_filter.rb +- lib/simplecov/profiles/hidden_filter.rb +- lib/simplecov/profiles/rails.rb +- lib/simplecov/profiles/root_filter.rb +- lib/simplecov/profiles/test_frameworks.rb - lib/simplecov/result.rb +- lib/simplecov/result_adapter.rb - lib/simplecov/result_merger.rb +- lib/simplecov/simulate_coverage.rb - lib/simplecov/source_file.rb +- lib/simplecov/source_file/branch.rb +- lib/simplecov/source_file/line.rb +- lib/simplecov/useless_results_remover.rb - lib/simplecov/version.rb -- simplecov.gemspec -- spec/1_8_fallbacks_spec.rb -- spec/command_guesser_spec.rb -- spec/deleted_source_spec.rb -- spec/faked_project/Gemfile -- spec/faked_project/Rakefile -- spec/faked_project/cucumber.yml -- spec/faked_project/features/step_definitions/my_steps.rb -- spec/faked_project/features/support/env.rb -- spec/faked_project/features/test_stuff.feature -- spec/faked_project/lib/faked_project.rb -- spec/faked_project/lib/faked_project/framework_specific.rb -- spec/faked_project/lib/faked_project/meta_magic.rb -- spec/faked_project/lib/faked_project/some_class.rb -- spec/faked_project/lib/faked_project/untested_class.rb -- spec/faked_project/spec/faked_spec.rb -- spec/faked_project/spec/forking_spec.rb -- spec/faked_project/spec/meta_magic_spec.rb -- spec/faked_project/spec/some_class_spec.rb -- spec/faked_project/spec/spec_helper.rb -- spec/faked_project/test/faked_test.rb -- spec/faked_project/test/meta_magic_test.rb -- spec/faked_project/test/some_class_test.rb -- spec/faked_project/test/test_helper.rb -- spec/file_list_spec.rb -- spec/filters_spec.rb -- spec/fixtures/app/controllers/sample_controller.rb -- spec/fixtures/app/models/user.rb -- spec/fixtures/deleted_source_sample.rb -- spec/fixtures/frameworks/rspec_bad.rb -- spec/fixtures/frameworks/rspec_good.rb -- spec/fixtures/frameworks/testunit_bad.rb -- spec/fixtures/frameworks/testunit_good.rb -- spec/fixtures/iso-8859.rb -- spec/fixtures/resultset1.rb -- spec/fixtures/resultset2.rb -- spec/fixtures/sample.rb -- spec/fixtures/utf-8.rb -- spec/helper.rb -- spec/merge_helpers_spec.rb -- spec/multi_formatter_spec.rb -- spec/result_spec.rb -- spec/return_codes_spec.rb -- spec/source_file_line_spec.rb -- spec/source_file_spec.rb -homepage: http://github.com/colszowka/simplecov +homepage: https://github.com/simplecov-ruby/simplecov licenses: - MIT -metadata: {} +metadata: + bug_tracker_uri: https://github.com/simplecov-ruby/simplecov/issues + changelog_uri: https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md + documentation_uri: https://www.rubydoc.info/gems/simplecov/0.19.1 + mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov + source_code_uri: https://github.com/simplecov-ruby/simplecov/tree/v0.19.1 post_install_message: rdoc_options: require_paths: @@ -207,17 +115,15 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 1.8.7 + version: 2.5.0 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: -rubyforge_project: -rubygems_version: 2.6.10 +rubygems_version: 3.1.2 signing_key: specification_version: 4 -summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic - merging of coverage across test suites +summary: Code coverage for Ruby test_files:
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2