simplecov 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +26 -2
- data/CONTRIBUTING.md +12 -9
- data/ISSUE_TEMPLATE.md +23 -0
- data/README.md +42 -16
- data/doc/alternate-formatters.md +16 -1
- data/lib/simplecov/command_guesser.rb +2 -0
- data/lib/simplecov/configuration.rb +2 -0
- data/lib/simplecov/defaults.rb +9 -80
- data/lib/simplecov/exit_codes.rb +2 -0
- data/lib/simplecov/file_list.rb +2 -0
- data/lib/simplecov/filter.rb +3 -1
- data/lib/simplecov/formatter/multi_formatter.rb +2 -0
- data/lib/simplecov/formatter/simple_formatter.rb +2 -0
- data/lib/simplecov/formatter.rb +2 -0
- data/lib/simplecov/jruby_fix.rb +2 -0
- data/lib/simplecov/last_run.rb +2 -0
- data/lib/simplecov/lines_classifier.rb +19 -3
- data/lib/simplecov/load_global_config.rb +2 -0
- data/lib/simplecov/no_defaults.rb +2 -0
- data/lib/simplecov/profiles/bundler_filter.rb +5 -0
- data/lib/simplecov/profiles/rails.rb +18 -0
- data/lib/simplecov/profiles/root_filter.rb +10 -0
- data/lib/simplecov/profiles/test_frameworks.rb +8 -0
- data/lib/simplecov/profiles.rb +2 -0
- data/lib/simplecov/railtie.rb +2 -0
- data/lib/simplecov/railties/tasks.rake +2 -0
- data/lib/simplecov/raw_coverage.rb +2 -0
- data/lib/simplecov/result.rb +2 -0
- data/lib/simplecov/result_merger.rb +2 -0
- data/lib/simplecov/source_file.rb +3 -1
- data/lib/simplecov/version.rb +3 -1
- data/lib/simplecov.rb +91 -0
- metadata +22 -117
- data/.gitignore +0 -31
- data/.rspec +0 -3
- data/.rubocop.yml +0 -88
- data/.travis.yml +0 -29
- data/.yardopts +0 -1
- data/Gemfile +0 -38
- data/MIT-LICENSE +0 -20
- data/Rakefile +0 -41
- data/cucumber.yml +0 -13
- data/features/config_autoload.feature +0 -46
- data/features/config_command_name.feature +0 -45
- data/features/config_coverage_dir.feature +0 -33
- data/features/config_deactivate_merging.feature +0 -42
- data/features/config_formatters.feature +0 -77
- data/features/config_merge_timeout.feature +0 -39
- data/features/config_nocov_token.feature +0 -79
- data/features/config_profiles.feature +0 -44
- data/features/config_project_name.feature +0 -27
- data/features/config_styles.feature +0 -121
- data/features/config_tracked_files.feature +0 -29
- data/features/config_tracked_files_relevant_lines.feature +0 -31
- data/features/cucumber_basic.feature +0 -29
- data/features/maximum_coverage_drop.feature +0 -89
- data/features/merging_test_unit_and_rspec.feature +0 -44
- data/features/minimum_coverage.feature +0 -59
- data/features/refuse_coverage_drop.feature +0 -95
- data/features/rspec_basic.feature +0 -32
- data/features/rspec_fails_on_initialization.feature +0 -14
- data/features/rspec_groups_and_filters_basic.feature +0 -29
- data/features/rspec_groups_and_filters_complex.feature +0 -37
- data/features/rspec_groups_using_filter_class.feature +0 -41
- data/features/rspec_without_simplecov.feature +0 -20
- data/features/skipping_code_blocks_manually.feature +0 -70
- data/features/step_definitions/html_steps.rb +0 -44
- data/features/step_definitions/simplecov_steps.rb +0 -68
- data/features/step_definitions/transformers.rb +0 -13
- data/features/step_definitions/web_steps.rb +0 -64
- data/features/support/aruba_freedom_patch.rb +0 -53
- data/features/support/env.rb +0 -50
- data/features/test_unit_basic.feature +0 -34
- data/features/test_unit_groups_and_filters_basic.feature +0 -29
- data/features/test_unit_groups_and_filters_complex.feature +0 -35
- data/features/test_unit_groups_using_filter_class.feature +0 -40
- data/features/test_unit_without_simplecov.feature +0 -20
- data/features/unicode_compatiblity.feature +0 -67
- data/simplecov.gemspec +0 -27
- data/spec/1_8_fallbacks_spec.rb +0 -31
- data/spec/command_guesser_spec.rb +0 -48
- data/spec/config_loader_spec.rb +0 -14
- data/spec/configuration_spec.rb +0 -35
- data/spec/deleted_source_spec.rb +0 -12
- data/spec/faked_project/Gemfile +0 -6
- data/spec/faked_project/Rakefile +0 -8
- data/spec/faked_project/cucumber.yml +0 -13
- data/spec/faked_project/features/step_definitions/my_steps.rb +0 -22
- data/spec/faked_project/features/support/env.rb +0 -12
- data/spec/faked_project/features/test_stuff.feature +0 -6
- data/spec/faked_project/lib/faked_project/framework_specific.rb +0 -18
- data/spec/faked_project/lib/faked_project/meta_magic.rb +0 -24
- data/spec/faked_project/lib/faked_project/some_class.rb +0 -28
- data/spec/faked_project/lib/faked_project/untested_class.rb +0 -11
- data/spec/faked_project/lib/faked_project.rb +0 -11
- data/spec/faked_project/spec/faked_spec.rb +0 -11
- data/spec/faked_project/spec/forking_spec.rb +0 -8
- data/spec/faked_project/spec/meta_magic_spec.rb +0 -15
- data/spec/faked_project/spec/some_class_spec.rb +0 -13
- data/spec/faked_project/spec/spec_helper.rb +0 -11
- data/spec/faked_project/test/faked_test.rb +0 -11
- data/spec/faked_project/test/meta_magic_test.rb +0 -13
- data/spec/faked_project/test/some_class_test.rb +0 -15
- data/spec/faked_project/test/test_helper.rb +0 -12
- data/spec/file_list_spec.rb +0 -50
- data/spec/filters_spec.rb +0 -172
- data/spec/fixtures/app/controllers/sample_controller.rb +0 -10
- data/spec/fixtures/app/models/user.rb +0 -10
- data/spec/fixtures/deleted_source_sample.rb +0 -15
- data/spec/fixtures/frameworks/rspec_bad.rb +0 -9
- data/spec/fixtures/frameworks/rspec_good.rb +0 -9
- data/spec/fixtures/frameworks/testunit_bad.rb +0 -9
- data/spec/fixtures/frameworks/testunit_good.rb +0 -9
- data/spec/fixtures/iso-8859.rb +0 -3
- data/spec/fixtures/never.rb +0 -2
- data/spec/fixtures/resultset1.rb +0 -4
- data/spec/fixtures/resultset2.rb +0 -4
- data/spec/fixtures/sample.rb +0 -16
- data/spec/fixtures/skipped.rb +0 -4
- data/spec/fixtures/skipped_and_executed.rb +0 -8
- data/spec/fixtures/utf-8.rb +0 -3
- data/spec/helper.rb +0 -26
- data/spec/last_run_spec.rb +0 -48
- data/spec/lines_classifier_spec.rb +0 -103
- data/spec/multi_formatter_spec.rb +0 -20
- data/spec/raw_coverage_spec.rb +0 -92
- data/spec/result_merger_spec.rb +0 -171
- data/spec/result_spec.rb +0 -209
- data/spec/return_codes_spec.rb +0 -34
- data/spec/simplecov_spec.rb +0 -109
- data/spec/source_file_line_spec.rb +0 -155
- data/spec/source_file_spec.rb +0 -145
- data/spec/support/fail_rspec_on_ruby_warning.rb +0 -75
|
@@ -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
|
-
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
@test_unit @config
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
The formatter for test coverage can be customized
|
|
5
|
-
with the SimpleCov.formatter setting. There are two
|
|
6
|
-
built-in formatters:
|
|
7
|
-
SimpleCov::Formatter::SimpleFormatter is a simple
|
|
8
|
-
formatter returning a string of all files with
|
|
9
|
-
theirs coverages.
|
|
10
|
-
SimpleCov::Formatter::MultiFormatter is a formatter
|
|
11
|
-
used to call multiple formatters at once.
|
|
12
|
-
|
|
13
|
-
Scenario: With SimpleFormatter
|
|
14
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
15
|
-
"""
|
|
16
|
-
require 'simplecov'
|
|
17
|
-
SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
|
|
18
|
-
SimpleCov.at_exit do
|
|
19
|
-
puts SimpleCov.result.format!
|
|
20
|
-
end
|
|
21
|
-
SimpleCov.start do
|
|
22
|
-
add_group 'Libs', 'lib/faked_project/'
|
|
23
|
-
end
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
When I successfully run `bundle exec rake test`
|
|
27
|
-
Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)"
|
|
28
|
-
|
|
29
|
-
Scenario: With MultiFormatter
|
|
30
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
31
|
-
"""
|
|
32
|
-
require 'simplecov'
|
|
33
|
-
SimpleCov.formatters = [
|
|
34
|
-
SimpleCov::Formatter::SimpleFormatter,
|
|
35
|
-
Class.new do
|
|
36
|
-
def format(result)
|
|
37
|
-
raise "Unable to format"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
SimpleCov.at_exit do
|
|
43
|
-
puts SimpleCov.result.format!.join
|
|
44
|
-
end
|
|
45
|
-
SimpleCov.start do
|
|
46
|
-
add_group 'Libs', 'lib/faked_project/'
|
|
47
|
-
end
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
When I successfully run `bundle exec rake test`
|
|
51
|
-
Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)"
|
|
52
|
-
And the output should match /Formatter [^\s]* failed with RuntimeError: Unable to format/
|
|
53
|
-
|
|
54
|
-
Scenario: With multiple formatters
|
|
55
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
56
|
-
"""
|
|
57
|
-
require 'simplecov'
|
|
58
|
-
SimpleCov.formatters = [
|
|
59
|
-
SimpleCov::Formatter::SimpleFormatter,
|
|
60
|
-
Class.new do
|
|
61
|
-
def format(result)
|
|
62
|
-
raise "Unable to format"
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
SimpleCov.at_exit do
|
|
68
|
-
puts SimpleCov.result.format!.join
|
|
69
|
-
end
|
|
70
|
-
SimpleCov.start do
|
|
71
|
-
add_group 'Libs', 'lib/faked_project/'
|
|
72
|
-
end
|
|
73
|
-
"""
|
|
74
|
-
|
|
75
|
-
When I successfully run `bundle exec rake test`
|
|
76
|
-
Then the output should contain "lib/faked_project/meta_magic.rb (coverage: 100.0%)"
|
|
77
|
-
And the output should match /Formatter [^\s]* failed with RuntimeError: Unable to format/
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
@test_unit @rspec @merging @config
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
The maximum time between resultset merges can be customized
|
|
5
|
-
using SimpleCov.merge_timeout SECONDS. This can be helpful for
|
|
6
|
-
long-running test-suites that fail to merge because of the time
|
|
7
|
-
between individual suite finishes is more then the default timeout
|
|
8
|
-
of 10 minutes.
|
|
9
|
-
|
|
10
|
-
Here, for the sake of testing the opposite case is shown, choosing
|
|
11
|
-
a merge timeout so short that the first test suite's results actually
|
|
12
|
-
are out of date when the second suite finishes and thus does not end up
|
|
13
|
-
in the report.
|
|
14
|
-
|
|
15
|
-
Scenario:
|
|
16
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
17
|
-
"""
|
|
18
|
-
require 'simplecov'
|
|
19
|
-
SimpleCov.start do
|
|
20
|
-
merge_timeout 5
|
|
21
|
-
end
|
|
22
|
-
"""
|
|
23
|
-
Given SimpleCov for RSpec is configured with:
|
|
24
|
-
"""
|
|
25
|
-
require 'simplecov'
|
|
26
|
-
SimpleCov.start do
|
|
27
|
-
merge_timeout 5
|
|
28
|
-
end
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
32
|
-
Then the report should be based upon:
|
|
33
|
-
| Unit Tests |
|
|
34
|
-
|
|
35
|
-
When I wait for 5 seconds
|
|
36
|
-
And I open the coverage report generated with `bundle exec rspec spec`
|
|
37
|
-
Then the report should be based upon:
|
|
38
|
-
| RSpec |
|
|
39
|
-
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
@test_unit @nocov
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
Code wrapped in # :nocov: will be ignored by coverage reports.
|
|
5
|
-
The name of the token can be configured with SimpleCov.nocov_token or SimpleCov.skip_token
|
|
6
|
-
|
|
7
|
-
Scenario: Custom nocov token using nocov_token
|
|
8
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
9
|
-
"""
|
|
10
|
-
require 'simplecov'
|
|
11
|
-
SimpleCov.start 'test_frameworks' do
|
|
12
|
-
nocov_token 'skippit'
|
|
13
|
-
end
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
Given a file named "lib/faked_project/nocov.rb" with:
|
|
17
|
-
"""
|
|
18
|
-
class SourceCodeWithNocov
|
|
19
|
-
# :skippit:
|
|
20
|
-
def some_weird_code
|
|
21
|
-
never_reached
|
|
22
|
-
rescue => err
|
|
23
|
-
but no one cares about invalid ruby here
|
|
24
|
-
end
|
|
25
|
-
# :skippit:
|
|
26
|
-
end
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
30
|
-
|
|
31
|
-
Then I should see the source files:
|
|
32
|
-
| name | coverage |
|
|
33
|
-
| lib/faked_project.rb | 100.0 % |
|
|
34
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
|
35
|
-
| lib/faked_project/framework_specific.rb | 75.0 % |
|
|
36
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
37
|
-
| lib/faked_project/nocov.rb | 100.0 % |
|
|
38
|
-
|
|
39
|
-
And there should be 7 skipped lines in the source files
|
|
40
|
-
|
|
41
|
-
And the report should be based upon:
|
|
42
|
-
| Unit Tests |
|
|
43
|
-
|
|
44
|
-
Scenario: Custom nocov token using skip_token
|
|
45
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
46
|
-
"""
|
|
47
|
-
require 'simplecov'
|
|
48
|
-
SimpleCov.start 'test_frameworks' do
|
|
49
|
-
skip_token 'skippit'
|
|
50
|
-
end
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
Given a file named "lib/faked_project/nocov.rb" with:
|
|
54
|
-
"""
|
|
55
|
-
class SourceCodeWithNocov
|
|
56
|
-
# :skippit:
|
|
57
|
-
def some_weird_code
|
|
58
|
-
never_reached
|
|
59
|
-
rescue => err
|
|
60
|
-
but no one cares about invalid ruby here
|
|
61
|
-
end
|
|
62
|
-
# :skippit:
|
|
63
|
-
end
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
67
|
-
|
|
68
|
-
Then I should see the source files:
|
|
69
|
-
| name | coverage |
|
|
70
|
-
| lib/faked_project.rb | 100.0 % |
|
|
71
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
|
72
|
-
| lib/faked_project/framework_specific.rb | 75.0 % |
|
|
73
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
74
|
-
| lib/faked_project/nocov.rb | 100.0 % |
|
|
75
|
-
|
|
76
|
-
And there should be 7 skipped lines in the source files
|
|
77
|
-
|
|
78
|
-
And the report should be based upon:
|
|
79
|
-
| Unit Tests |
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
@test_unit @config @profiles
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
In order to re-use SimpleCov settings across projects,
|
|
5
|
-
profiles can be defined that hold configuration settings
|
|
6
|
-
that can be loaded at once.
|
|
7
|
-
|
|
8
|
-
Background:
|
|
9
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
10
|
-
"""
|
|
11
|
-
require 'simplecov'
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
Scenario: Defining and using a custom profile
|
|
15
|
-
Given a file named ".simplecov" with:
|
|
16
|
-
"""
|
|
17
|
-
SimpleCov.profiles.define 'custom_command' do
|
|
18
|
-
command_name "Profile Command"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
SimpleCov.start do
|
|
22
|
-
load_profile 'test_frameworks'
|
|
23
|
-
load_profile 'custom_command'
|
|
24
|
-
end
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
28
|
-
Then I should see "4 files in total."
|
|
29
|
-
And I should see "using Profile Command" within "#footer"
|
|
30
|
-
|
|
31
|
-
Scenario: Using existing profile in custom profile and supplying profile to start command
|
|
32
|
-
Given a file named ".simplecov" with:
|
|
33
|
-
"""
|
|
34
|
-
SimpleCov.profiles.define 'my_profile' do
|
|
35
|
-
load_profile 'test_frameworks'
|
|
36
|
-
command_name "My Profile"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
SimpleCov.start 'my_profile'
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
43
|
-
Then I should see "4 files in total."
|
|
44
|
-
And I should see "using My Profile" within "#footer"
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
@test_unit @config
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
SimpleCov guesses the project name from the project root dir's name.
|
|
5
|
-
If this is not sufficient for you, you can specify a custom name using
|
|
6
|
-
SimpleCov.project_name('xyz')
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Scenario: Guessed name
|
|
10
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
11
|
-
"""
|
|
12
|
-
require 'simplecov'
|
|
13
|
-
SimpleCov.start
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
17
|
-
Then I should see "Code coverage for Project" within "title"
|
|
18
|
-
|
|
19
|
-
Scenario: Custom name
|
|
20
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
21
|
-
"""
|
|
22
|
-
require 'simplecov'
|
|
23
|
-
SimpleCov.start { project_name "Superfancy 2.0" }
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
27
|
-
Then I should see "Code coverage for Superfancy 2.0" within "title"
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
@test_unit @config
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
There's several ways to configure SimpleCov. All of those
|
|
5
|
-
config schemes below are equivalent and can be chosen by personal
|
|
6
|
-
preference or project requirements.
|
|
7
|
-
|
|
8
|
-
Background:
|
|
9
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
10
|
-
"""
|
|
11
|
-
require 'simplecov'
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
Scenario: Inside start block
|
|
15
|
-
Given a file named ".simplecov" with:
|
|
16
|
-
"""
|
|
17
|
-
SimpleCov.start do
|
|
18
|
-
add_filter 'test'
|
|
19
|
-
command_name 'Config Test Runner'
|
|
20
|
-
end
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
24
|
-
Then I should see "4 files in total."
|
|
25
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
26
|
-
|
|
27
|
-
Scenario: Inside start block, using instance var from outside
|
|
28
|
-
Given a file named ".simplecov" with:
|
|
29
|
-
"""
|
|
30
|
-
@filter = 'test'
|
|
31
|
-
SimpleCov.start do
|
|
32
|
-
add_filter @filter
|
|
33
|
-
command_name 'Config Test Runner'
|
|
34
|
-
end
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
38
|
-
Then I should see "4 files in total."
|
|
39
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
40
|
-
|
|
41
|
-
Scenario: Inside start block, using local var from outside
|
|
42
|
-
Given a file named ".simplecov" with:
|
|
43
|
-
"""
|
|
44
|
-
filter = 'test'
|
|
45
|
-
SimpleCov.start do
|
|
46
|
-
add_filter filter
|
|
47
|
-
command_name 'Config Test Runner'
|
|
48
|
-
end
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
52
|
-
Then I should see "4 files in total."
|
|
53
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
54
|
-
|
|
55
|
-
Scenario: Explicitly before start block
|
|
56
|
-
Given a file named ".simplecov" with:
|
|
57
|
-
"""
|
|
58
|
-
SimpleCov.add_filter 'test'
|
|
59
|
-
SimpleCov.command_name 'Config Test Runner'
|
|
60
|
-
SimpleCov.start
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
64
|
-
Then I should see "4 files in total."
|
|
65
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
66
|
-
|
|
67
|
-
Scenario: Explicitly after start block
|
|
68
|
-
Given a file named ".simplecov" with:
|
|
69
|
-
"""
|
|
70
|
-
SimpleCov.start
|
|
71
|
-
SimpleCov.add_filter 'test'
|
|
72
|
-
SimpleCov.command_name 'Config Test Runner'
|
|
73
|
-
"""
|
|
74
|
-
|
|
75
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
76
|
-
Then I should see "4 files in total."
|
|
77
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
78
|
-
|
|
79
|
-
Scenario: Using configure block after start
|
|
80
|
-
Given a file named ".simplecov" with:
|
|
81
|
-
"""
|
|
82
|
-
SimpleCov.start
|
|
83
|
-
SimpleCov.configure do
|
|
84
|
-
add_filter 'test'
|
|
85
|
-
command_name 'Config Test Runner'
|
|
86
|
-
end
|
|
87
|
-
"""
|
|
88
|
-
|
|
89
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
90
|
-
Then I should see "4 files in total."
|
|
91
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
92
|
-
|
|
93
|
-
Scenario: Using configure block before start
|
|
94
|
-
Given a file named ".simplecov" with:
|
|
95
|
-
"""
|
|
96
|
-
SimpleCov.configure do
|
|
97
|
-
add_filter 'test'
|
|
98
|
-
command_name 'Config Test Runner'
|
|
99
|
-
end
|
|
100
|
-
SimpleCov.start
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
104
|
-
Then I should see "4 files in total."
|
|
105
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
106
|
-
|
|
107
|
-
Scenario: Mixing configure and start block config
|
|
108
|
-
Given a file named ".simplecov" with:
|
|
109
|
-
"""
|
|
110
|
-
SimpleCov.configure do
|
|
111
|
-
command_name 'Config Test Runner'
|
|
112
|
-
end
|
|
113
|
-
SimpleCov.start do
|
|
114
|
-
add_filter 'test'
|
|
115
|
-
end
|
|
116
|
-
"""
|
|
117
|
-
|
|
118
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
119
|
-
Then I should see "4 files in total."
|
|
120
|
-
And I should see "using Config Test Runner" within "#footer"
|
|
121
|
-
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
@test_unit
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
Using the setting `tracked_files` should add files that were not
|
|
5
|
-
required to the report.
|
|
6
|
-
|
|
7
|
-
Scenario:
|
|
8
|
-
Given SimpleCov for Test/Unit is configured with:
|
|
9
|
-
"""
|
|
10
|
-
require 'simplecov'
|
|
11
|
-
SimpleCov.start do
|
|
12
|
-
track_files "lib/**/*.rb"
|
|
13
|
-
end
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
When I open the coverage report generated with `bundle exec rake test`
|
|
17
|
-
Then I should see the groups:
|
|
18
|
-
| name | coverage | files |
|
|
19
|
-
| All Files | 77.94% | 7 |
|
|
20
|
-
|
|
21
|
-
And I should see the source files:
|
|
22
|
-
| name | coverage |
|
|
23
|
-
| lib/faked_project.rb | 100.0 % |
|
|
24
|
-
| lib/faked_project/untested_class.rb | 0.0 % |
|
|
25
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
|
26
|
-
| lib/faked_project/framework_specific.rb | 75.0 % |
|
|
27
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
28
|
-
| test/meta_magic_test.rb | 100.0 % |
|
|
29
|
-
| test/some_class_test.rb | 100.0 % |
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
@rspec
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
Using the setting `tracked_files` should classify whether lines
|
|
5
|
-
are relevant or not (such as whitespace or comments).
|
|
6
|
-
|
|
7
|
-
Scenario:
|
|
8
|
-
Given SimpleCov for RSpec is configured with:
|
|
9
|
-
"""
|
|
10
|
-
require 'simplecov'
|
|
11
|
-
SimpleCov.start do
|
|
12
|
-
track_files "lib/**/*.rb"
|
|
13
|
-
end
|
|
14
|
-
"""
|
|
15
|
-
Given a file named "lib/not_loaded.rb" with:
|
|
16
|
-
"""
|
|
17
|
-
# A comment line. Plus a whitespace line below:
|
|
18
|
-
|
|
19
|
-
# :nocov:
|
|
20
|
-
def ignore_me
|
|
21
|
-
end
|
|
22
|
-
# :nocov:
|
|
23
|
-
|
|
24
|
-
def this_is_relevant
|
|
25
|
-
puts "still relevant"
|
|
26
|
-
end
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
When I open the coverage report generated with `bundle exec rspec spec`
|
|
30
|
-
Then I follow "lib/not_loaded.rb"
|
|
31
|
-
Then I should see "3 relevant lines" within ".highlighted"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
@cucumber
|
|
2
|
-
Feature:
|
|
3
|
-
|
|
4
|
-
Simply adding the basic simplecov lines to a project should get
|
|
5
|
-
the user a coverage report after running `cucumber features`
|
|
6
|
-
|
|
7
|
-
Scenario:
|
|
8
|
-
Given SimpleCov for Cucumber is configured with:
|
|
9
|
-
"""
|
|
10
|
-
require 'simplecov'
|
|
11
|
-
SimpleCov.start
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
When I open the coverage report generated with `bundle exec cucumber features`
|
|
15
|
-
Then I should see the groups:
|
|
16
|
-
| name | coverage | files |
|
|
17
|
-
| All Files | 91.23% | 6 |
|
|
18
|
-
|
|
19
|
-
And I should see the source files:
|
|
20
|
-
| name | coverage |
|
|
21
|
-
| lib/faked_project.rb | 100.0 % |
|
|
22
|
-
| lib/faked_project/some_class.rb | 80.0 % |
|
|
23
|
-
| lib/faked_project/framework_specific.rb | 75.0 % |
|
|
24
|
-
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
25
|
-
| features/step_definitions/my_steps.rb | 100.0 % |
|
|
26
|
-
| features/support/simplecov_config.rb | 100.0 % |
|
|
27
|
-
|
|
28
|
-
And the report should be based upon:
|
|
29
|
-
| Cucumber Features |
|