simplecov 0.15.1 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +17 -1
  3. data/CONTRIBUTING.md +12 -9
  4. data/ISSUE_TEMPLATE.md +23 -0
  5. data/README.md +41 -14
  6. data/doc/alternate-formatters.md +10 -0
  7. data/lib/simplecov.rb +91 -0
  8. data/lib/simplecov/command_guesser.rb +2 -0
  9. data/lib/simplecov/configuration.rb +2 -0
  10. data/lib/simplecov/defaults.rb +9 -80
  11. data/lib/simplecov/exit_codes.rb +2 -0
  12. data/lib/simplecov/file_list.rb +2 -0
  13. data/lib/simplecov/filter.rb +3 -1
  14. data/lib/simplecov/formatter.rb +2 -0
  15. data/lib/simplecov/formatter/multi_formatter.rb +2 -0
  16. data/lib/simplecov/formatter/simple_formatter.rb +2 -0
  17. data/lib/simplecov/jruby_fix.rb +2 -0
  18. data/lib/simplecov/last_run.rb +2 -0
  19. data/lib/simplecov/lines_classifier.rb +19 -3
  20. data/lib/simplecov/load_global_config.rb +2 -0
  21. data/lib/simplecov/no_defaults.rb +2 -0
  22. data/lib/simplecov/profiles.rb +2 -0
  23. data/lib/simplecov/profiles/bundler_filter.rb +5 -0
  24. data/lib/simplecov/profiles/rails.rb +18 -0
  25. data/lib/simplecov/profiles/root_filter.rb +10 -0
  26. data/lib/simplecov/profiles/test_frameworks.rb +8 -0
  27. data/lib/simplecov/railtie.rb +2 -0
  28. data/lib/simplecov/railties/tasks.rake +2 -0
  29. data/lib/simplecov/raw_coverage.rb +2 -0
  30. data/lib/simplecov/result.rb +2 -0
  31. data/lib/simplecov/result_merger.rb +2 -0
  32. data/lib/simplecov/source_file.rb +3 -1
  33. data/lib/simplecov/version.rb +3 -1
  34. metadata +22 -118
  35. data/.gitignore +0 -31
  36. data/.rspec +0 -3
  37. data/.rubocop.yml +0 -88
  38. data/.travis.yml +0 -29
  39. data/.yardopts +0 -1
  40. data/Gemfile +0 -38
  41. data/MIT-LICENSE +0 -20
  42. data/Rakefile +0 -39
  43. data/cucumber.yml +0 -13
  44. data/features/config_autoload.feature +0 -46
  45. data/features/config_command_name.feature +0 -45
  46. data/features/config_coverage_dir.feature +0 -33
  47. data/features/config_deactivate_merging.feature +0 -42
  48. data/features/config_formatters.feature +0 -77
  49. data/features/config_merge_timeout.feature +0 -39
  50. data/features/config_nocov_token.feature +0 -79
  51. data/features/config_profiles.feature +0 -44
  52. data/features/config_project_name.feature +0 -27
  53. data/features/config_styles.feature +0 -121
  54. data/features/config_tracked_files.feature +0 -29
  55. data/features/config_tracked_files_relevant_lines.feature +0 -31
  56. data/features/cucumber_basic.feature +0 -29
  57. data/features/maximum_coverage_drop.feature +0 -89
  58. data/features/merging_test_unit_and_rspec.feature +0 -44
  59. data/features/minimum_coverage.feature +0 -59
  60. data/features/refuse_coverage_drop.feature +0 -95
  61. data/features/rspec_basic.feature +0 -32
  62. data/features/rspec_fails_on_initialization.feature +0 -14
  63. data/features/rspec_groups_and_filters_basic.feature +0 -29
  64. data/features/rspec_groups_and_filters_complex.feature +0 -37
  65. data/features/rspec_groups_using_filter_class.feature +0 -41
  66. data/features/rspec_without_simplecov.feature +0 -20
  67. data/features/skipping_code_blocks_manually.feature +0 -70
  68. data/features/step_definitions/html_steps.rb +0 -44
  69. data/features/step_definitions/simplecov_steps.rb +0 -68
  70. data/features/step_definitions/transformers.rb +0 -13
  71. data/features/step_definitions/web_steps.rb +0 -64
  72. data/features/support/aruba_freedom_patch.rb +0 -53
  73. data/features/support/env.rb +0 -50
  74. data/features/test_unit_basic.feature +0 -34
  75. data/features/test_unit_groups_and_filters_basic.feature +0 -29
  76. data/features/test_unit_groups_and_filters_complex.feature +0 -35
  77. data/features/test_unit_groups_using_filter_class.feature +0 -40
  78. data/features/test_unit_without_simplecov.feature +0 -20
  79. data/features/unicode_compatiblity.feature +0 -67
  80. data/simplecov.gemspec +0 -27
  81. data/spec/1_8_fallbacks_spec.rb +0 -31
  82. data/spec/command_guesser_spec.rb +0 -48
  83. data/spec/config_loader_spec.rb +0 -14
  84. data/spec/configuration_spec.rb +0 -35
  85. data/spec/defaults_spec.rb +0 -41
  86. data/spec/deleted_source_spec.rb +0 -12
  87. data/spec/faked_project/Gemfile +0 -6
  88. data/spec/faked_project/Rakefile +0 -8
  89. data/spec/faked_project/cucumber.yml +0 -13
  90. data/spec/faked_project/features/step_definitions/my_steps.rb +0 -22
  91. data/spec/faked_project/features/support/env.rb +0 -12
  92. data/spec/faked_project/features/test_stuff.feature +0 -6
  93. data/spec/faked_project/lib/faked_project.rb +0 -11
  94. data/spec/faked_project/lib/faked_project/framework_specific.rb +0 -18
  95. data/spec/faked_project/lib/faked_project/meta_magic.rb +0 -24
  96. data/spec/faked_project/lib/faked_project/some_class.rb +0 -28
  97. data/spec/faked_project/lib/faked_project/untested_class.rb +0 -11
  98. data/spec/faked_project/spec/faked_spec.rb +0 -11
  99. data/spec/faked_project/spec/forking_spec.rb +0 -8
  100. data/spec/faked_project/spec/meta_magic_spec.rb +0 -15
  101. data/spec/faked_project/spec/some_class_spec.rb +0 -13
  102. data/spec/faked_project/spec/spec_helper.rb +0 -11
  103. data/spec/faked_project/test/faked_test.rb +0 -11
  104. data/spec/faked_project/test/meta_magic_test.rb +0 -13
  105. data/spec/faked_project/test/some_class_test.rb +0 -15
  106. data/spec/faked_project/test/test_helper.rb +0 -12
  107. data/spec/file_list_spec.rb +0 -50
  108. data/spec/filters_spec.rb +0 -202
  109. data/spec/fixtures/app/controllers/sample_controller.rb +0 -10
  110. data/spec/fixtures/app/models/user.rb +0 -10
  111. data/spec/fixtures/deleted_source_sample.rb +0 -15
  112. data/spec/fixtures/frameworks/rspec_bad.rb +0 -9
  113. data/spec/fixtures/frameworks/rspec_good.rb +0 -9
  114. data/spec/fixtures/frameworks/testunit_bad.rb +0 -9
  115. data/spec/fixtures/frameworks/testunit_good.rb +0 -9
  116. data/spec/fixtures/iso-8859.rb +0 -3
  117. data/spec/fixtures/never.rb +0 -2
  118. data/spec/fixtures/resultset1.rb +0 -4
  119. data/spec/fixtures/resultset2.rb +0 -4
  120. data/spec/fixtures/sample.rb +0 -16
  121. data/spec/fixtures/skipped.rb +0 -4
  122. data/spec/fixtures/skipped_and_executed.rb +0 -8
  123. data/spec/fixtures/utf-8.rb +0 -3
  124. data/spec/helper.rb +0 -26
  125. data/spec/last_run_spec.rb +0 -48
  126. data/spec/lines_classifier_spec.rb +0 -103
  127. data/spec/multi_formatter_spec.rb +0 -20
  128. data/spec/raw_coverage_spec.rb +0 -92
  129. data/spec/result_merger_spec.rb +0 -171
  130. data/spec/result_spec.rb +0 -209
  131. data/spec/return_codes_spec.rb +0 -34
  132. data/spec/simplecov_spec.rb +0 -109
  133. data/spec/source_file_line_spec.rb +0 -155
  134. data/spec/source_file_spec.rb +0 -145
  135. data/spec/support/fail_rspec_on_ruby_warning.rb +0 -75
data/.gitignore DELETED
@@ -1,31 +0,0 @@
1
- .bundle
2
- Gemfile.lock
3
- gemfiles/*.lock
4
-
5
- ## MAC OS
6
- .DS_Store
7
- .document
8
-
9
- ## TEXTMATE
10
- *.tmproj
11
- tmtags
12
-
13
- ## EMACS
14
- *~
15
- \#*
16
- .\#*
17
-
18
- ## VIM
19
- *.swp
20
-
21
- ## PROJECT::GENERAL
22
- coverage
23
- rdoc
24
- pkg
25
- tmp
26
- capybara*.html
27
- .rvmrc
28
-
29
- ## PROJECT::SPECIFIC
30
-
31
- .yardoc
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --order random
3
- --warning
@@ -1,88 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - 'spec/fixtures/iso-8859.rb'
4
- - 'tmp/**/*'
5
- - 'vendor/bundle/**/*'
6
- TargetRubyVersion: 1.9
7
-
8
- Bundler/OrderedGems:
9
- Enabled: false
10
-
11
- Lint/AmbiguousRegexpLiteral:
12
- Exclude:
13
- - 'features/**/*_steps.rb'
14
- - 'spec/**/*_steps.rb'
15
- - 'tmp/**/*_steps.rb'
16
-
17
- Metrics/AbcSize:
18
- Max: 25 # TODO: Lower to 15
19
-
20
- Metrics/BlockLength:
21
- Exclude:
22
- - 'spec/**/*.rb'
23
-
24
- Metrics/BlockNesting:
25
- Max: 2
26
-
27
- Metrics/LineLength:
28
- AllowURI: true
29
- Enabled: false
30
-
31
- Metrics/MethodLength:
32
- CountComments: false
33
- Max: 12 # TODO: Lower to 10
34
-
35
- Metrics/ParameterLists:
36
- Max: 4
37
- CountKeywordArgs: true
38
-
39
- Layout/AccessModifierIndentation:
40
- EnforcedStyle: outdent
41
-
42
- Style/CollectionMethods:
43
- PreferredMethods:
44
- map: 'collect'
45
- reduce: 'inject'
46
- find: 'detect'
47
- find_all: 'select'
48
-
49
- Style/Documentation:
50
- Enabled: false
51
-
52
- Style/DoubleNegation:
53
- Enabled: false
54
-
55
- Style/HashSyntax:
56
- EnforcedStyle: hash_rockets
57
-
58
- Layout/IndentHeredoc:
59
- Enabled: false
60
-
61
- Style/RegexpLiteral:
62
- Enabled: false
63
-
64
- Layout/SpaceInsideHashLiteralBraces:
65
- EnforcedStyle: no_space
66
-
67
- Style/SpecialGlobalVars:
68
- Exclude:
69
- - 'spec/deleted_source_spec.rb'
70
- - 'spec/return_codes_spec.rb'
71
- - 'lib/simplecov/defaults.rb'
72
-
73
- Style/StringLiterals:
74
- EnforcedStyle: double_quotes
75
-
76
- Style/FileName:
77
- Exclude:
78
- - 'spec/fixtures/utf-8.rb'
79
-
80
- Style/TrailingCommaInLiteral:
81
- EnforcedStyleForMultiline: comma
82
-
83
- Style/GuardClause:
84
- Enabled: false
85
-
86
- Style/MutableConstant:
87
- Exclude:
88
- - 'lib/simplecov/version.rb' # required for older versions of rubygems
@@ -1,29 +0,0 @@
1
- language: ruby
2
-
3
- before_install:
4
- - gem update --system
5
- - gem install bundler
6
-
7
- bundler_args: --without development --jobs=3 --retry=3
8
-
9
- cache: bundler
10
-
11
- sudo: false
12
-
13
- rvm:
14
- - 1.8.7
15
- - 1.9.3
16
- - 2.0.0
17
- - 2.1.10
18
- - 2.2.7
19
- - 2.3.4
20
- - 2.4.1
21
- - jruby-9.1.13.0
22
- - ruby-head
23
- - jruby-head
24
-
25
- matrix:
26
- allow_failures:
27
- - rvm: ruby-head
28
- - rvm: jruby-head
29
- fast_finish: true
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- - **/*.md
data/Gemfile DELETED
@@ -1,38 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Uncomment this to use local copy of simplecov-html in development when checked out
4
- # gem 'simplecov-html', :path => ::File.dirname(__FILE__) + '/../simplecov-html'
5
-
6
- # Uncomment this to use development version of html formatter from github
7
- # gem 'simplecov-html', :github => 'colszowka/simplecov-html'
8
-
9
- gem "rake", Gem::Version.new(RUBY_VERSION) < Gem::Version.new("1.9.3") ? "~>10.3" : ">= 10.3"
10
-
11
- group :test do
12
- gem "rspec", ">= 3.2"
13
- # Older versions of some gems required for Ruby 1.8.7 support
14
- platforms :ruby_18 do
15
- gem "activesupport", "~> 3.2.21"
16
- gem "i18n", "~> 0.6.11"
17
- end
18
- platforms :ruby_18, :ruby_19 do
19
- gem "mime-types", "~> 1.25"
20
- gem "addressable", "~> 2.3.0"
21
- end
22
- platforms :ruby_18, :ruby_19, :ruby_20, :ruby_21 do
23
- gem "rack", "~> 1.6"
24
- end
25
- platforms :jruby, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25 do
26
- gem "aruba", "~> 0.14"
27
- gem "capybara"
28
- gem "nokogiri", RUBY_VERSION < "2.1" ? "~> 1.6.0" : ">= 1.7"
29
- gem "cucumber"
30
- gem "phantomjs", "~> 2.1"
31
- gem "poltergeist"
32
- gem "rubocop", "0.49.1" unless RUBY_VERSION.start_with?("1.")
33
- gem "test-unit"
34
- end
35
- gem "json", RUBY_VERSION.start_with?("1.") ? "~> 1.8" : "~> 2.0"
36
- end
37
-
38
- gemspec
@@ -1,20 +0,0 @@
1
- Copyright (c) 2010-2017 Christoph Olszowka
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,39 +0,0 @@
1
- require "rubygems"
2
- require "bundler/setup"
3
- Bundler::GemHelper.install_tasks
4
-
5
- # See https://github.com/colszowka/simplecov/issues/171
6
- desc "Set permissions on all files so they are compatible with both user-local and system-wide installs"
7
- task :fix_permissions do
8
- system 'bash -c "find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;"'
9
- end
10
- # Enforce proper permissions on each build
11
- Rake::Task[:build].prerequisites.unshift :fix_permissions
12
-
13
- require "rspec/core/rake_task"
14
- RSpec::Core::RakeTask.new(:spec) do |spec|
15
- spec.pattern = FileList["spec/*_spec.rb"]
16
- end
17
-
18
- begin
19
- require "rubocop/rake_task"
20
- RuboCop::RakeTask.new
21
- rescue LoadError
22
- task :rubocop do
23
- $stderr.puts "Rubocop is disabled"
24
- end
25
- end
26
-
27
- # Cucumber integration test suite is for impls that work with simplecov only - a.k.a. 1.9+
28
- if RUBY_VERSION.start_with? "1.8"
29
- task :default => [:spec]
30
- else
31
- require "cucumber/rake/task"
32
- Cucumber::Rake::Task.new
33
-
34
- if RUBY_VERSION.start_with? "1.9"
35
- task :default => [:spec, :cucumber]
36
- else
37
- task :default => [:rubocop, :spec, :cucumber]
38
- end
39
- end
@@ -1,13 +0,0 @@
1
- <%
2
- rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
- rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
- std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5
- interp_opts = if defined?(RUBY_ENGINE)
6
- " --tags ~@exclude-#{RUBY_ENGINE}"
7
- else
8
- ''
9
- end
10
- %>
11
- default: <%= std_opts %><%= interp_opts %> features
12
- wip: --tags @wip:30 --wip features<%= interp_opts %>
13
- rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip<%= interp_opts %>
@@ -1,46 +0,0 @@
1
- @test_unit @rspec @config
2
- Feature:
3
-
4
- If you have multiple test suites, it can be a bit cumbersome
5
- to keep the configuration across them in sync. SimpleCov
6
- is able to find a config file called '.simplecov' that resides
7
- in your project's root and will automatically use it when
8
- loaded.
9
-
10
- This gives you the ability to configure SimpleCov just once
11
- and then use the same configuration on all test suites simply
12
- by doing a 'require "simplecov"'
13
-
14
- Scenario:
15
- Given a file named ".simplecov" with:
16
- """
17
- SimpleCov.start do
18
- add_filter 'test.rb'
19
- add_filter 'spec.rb'
20
- end
21
- """
22
- Given SimpleCov for Test/Unit is configured with:
23
- """
24
- require 'simplecov'
25
- """
26
- Given SimpleCov for RSpec is configured with:
27
- """
28
- require 'simplecov'
29
- """
30
-
31
- When I successfully run `bundle exec rake test`
32
- And I open the coverage report generated with `bundle exec rspec spec`
33
- Then the report should be based upon:
34
- | RSpec |
35
- | Unit Tests |
36
-
37
- And I should see the groups:
38
- | name | coverage | files |
39
- | All Files | 90.48% | 4 |
40
-
41
- And I should see the source files:
42
- | name | coverage |
43
- | lib/faked_project.rb | 100.0 % |
44
- | lib/faked_project/some_class.rb | 80.0 % |
45
- | lib/faked_project/framework_specific.rb | 87.5 % |
46
- | lib/faked_project/meta_magic.rb | 100.0 % |
@@ -1,45 +0,0 @@
1
- @test_unit @rspec @merging @config
2
- Feature: Custom names for individual test suites
3
-
4
- Each test suite needs a name it can be identified by. SimpleCov tries
5
- best to detect Rails' Unit, Functional, Integration tests as well as regular
6
- Test/Unit, RSpec and Cucumber, but if that is insufficient, each test suite
7
- config can be given a custom command name using SimpleCov.command_name.
8
-
9
- Scenario:
10
- Given SimpleCov for Test/Unit is configured with:
11
- """
12
- require 'simplecov'
13
- SimpleCov.start do
14
- command_name "I'm in UR Unitz"
15
- end
16
- """
17
- Given SimpleCov for RSpec is configured with:
18
- """
19
- require 'simplecov'
20
- SimpleCov.start do
21
- command_name "Dreck macht Speck"
22
- end
23
- """
24
-
25
- When I open the coverage report generated with `bundle exec rake test`
26
- Then the report should be based upon:
27
- | I'm in UR Unitz |
28
-
29
- When I open the coverage report generated with `bundle exec rspec spec`
30
- Then the report should be based upon:
31
- | Dreck macht Speck |
32
- | I'm in UR Unitz |
33
-
34
- Scenario: RSpec auto detection with spec/features
35
- Given SimpleCov for RSpec is configured with:
36
- """
37
- require 'simplecov'
38
- SimpleCov.start
39
- """
40
- And a file named "spec/features/foobar_spec.rb" with:
41
- """
42
- """
43
- When I open the coverage report generated with `bundle exec rspec spec`
44
- Then the report should be based upon:
45
- | RSpec |
@@ -1,33 +0,0 @@
1
- @test_unit @config
2
- Feature:
3
-
4
- The output directory for test coverage can be customized
5
- with the SimpleCov.coverage_dir setting. All coverage reports
6
- will be put there instead of the default 'coverage' directory
7
- in your project's root.
8
-
9
- Scenario:
10
- Given SimpleCov for Test/Unit is configured with:
11
- """
12
- require 'simplecov'
13
- SimpleCov.start do
14
- coverage_dir 'test/simplecov'
15
- end
16
- """
17
-
18
- When I successfully run `bundle exec rake test`
19
- Then a coverage report should have been generated in "test/simplecov"
20
- And a directory named "coverage" should not exist
21
-
22
- Scenario:
23
- Given SimpleCov for Test/Unit is configured with:
24
- """
25
- require 'simplecov'
26
- SimpleCov.start do
27
- coverage_dir '/tmp/test/simplecov'
28
- end
29
- """
30
-
31
- When I successfully run `bundle exec rake test`
32
- Then a coverage report should have been generated in "/tmp/test/simplecov"
33
- And a directory named "coverage" should not exist
@@ -1,42 +0,0 @@
1
- @test_unit @rspec @merging @config
2
- Feature:
3
-
4
- If merging of test suite results is not desired, it can be deactivated,
5
- thus leading to the coverage report being overwritten with the latest results
6
- of a single test suite on each run of any suite.
7
-
8
- It's probably preferrable to generate the individual suite results into separate
9
- output directories instead (see SimpleCov.coverage_dir), but it is possible :)
10
-
11
- Scenario:
12
- Given SimpleCov for Test/Unit is configured with:
13
- """
14
- require 'simplecov'
15
- SimpleCov.start do
16
- use_merging false
17
- end
18
- """
19
- Given SimpleCov for RSpec is configured with:
20
- """
21
- require 'simplecov'
22
- SimpleCov.start do
23
- use_merging false
24
- end
25
- """
26
-
27
- When I successfully run `bundle exec rake test`
28
- Then a file named "coverage/index.html" should exist
29
- But a file named "coverage/.resultset.json" should not exist
30
-
31
- Given I open the coverage report
32
- Then the report should be based upon:
33
- | Unit Tests |
34
-
35
- When I successfully run `bundle exec rspec spec`
36
- Then a file named "coverage/index.html" should exist
37
- But a file named "coverage/.resultset.json" should not exist
38
-
39
- Given I open the coverage report
40
- Then the report should be based upon:
41
- | RSpec |
42
-