simplecov 0.7.1 → 0.8.0.pre
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.
- data/.travis.yml +9 -2
- data/CHANGELOG.md +17 -2
- data/Gemfile +13 -2
- data/{LICENSE → MIT-LICENSE} +0 -0
- data/README.md +174 -117
- data/Rakefile +8 -3
- data/features/config_command_name.feature +12 -0
- data/features/config_merge_timeout.feature +3 -3
- data/features/config_profiles.feature +44 -0
- data/features/config_project_name.feature +2 -2
- data/features/cucumber_basic.feature +1 -1
- data/features/step_definitions/html_steps.rb +1 -1
- data/features/support/env.rb +23 -5
- data/gemfiles/multi_json_legacy.gemfile +12 -0
- data/gemfiles/multi_json_new.gemfile +12 -0
- data/lib/simplecov.rb +33 -25
- data/lib/simplecov/command_guesser.rb +6 -6
- data/lib/simplecov/configuration.rb +7 -2
- data/lib/simplecov/defaults.rb +9 -5
- data/lib/simplecov/file_list.rb +1 -1
- data/lib/simplecov/jruby16_fix.rb +43 -0
- data/lib/simplecov/no_defaults.rb +2 -0
- data/lib/simplecov/{adapters.rb → profiles.rb} +8 -8
- data/lib/simplecov/result.rb +10 -2
- data/lib/simplecov/source_file.rb +2 -3
- data/lib/simplecov/version.rb +1 -1
- data/simplecov.gemspec +8 -9
- data/test/faked_project/Gemfile +1 -1
- data/test/helper.rb +0 -1
- data/test/shoulda_macros.rb +0 -10
- data/test/test_1_8_fallbacks.rb +16 -18
- data/test/test_command_guesser.rb +13 -15
- data/test/test_deleted_source.rb +5 -7
- data/test/test_file_list.rb +15 -17
- data/test/test_filters.rb +56 -58
- data/test/test_merge_helpers.rb +73 -75
- data/test/test_result.rb +114 -116
- data/test/test_return_codes.rb +24 -26
- data/test/test_source_file.rb +75 -64
- data/test/test_source_file_line.rb +78 -82
- metadata +38 -86
- data/features/config_adapters.feature +0 -44
- data/gemfiles/multi_json-legacy.gemfile +0 -7
- data/gemfiles/multi_json-new.gemfile +0 -7
data/.travis.yml
CHANGED
@@ -5,16 +5,23 @@ script:
|
|
5
5
|
- rake appraisal:install
|
6
6
|
- rake appraisal
|
7
7
|
rvm:
|
8
|
+
- ree
|
8
9
|
- 1.8.7
|
9
10
|
- 1.9.2
|
10
11
|
- 1.9.3
|
11
|
-
-
|
12
|
-
- ree
|
12
|
+
- 2.0.0
|
13
13
|
- rbx-18mode
|
14
|
+
- rbx-19mode
|
14
15
|
- jruby-18mode
|
16
|
+
- jruby-19mode
|
17
|
+
- jruby-head
|
18
|
+
- ruby-head
|
15
19
|
matrix:
|
16
20
|
allow_failures:
|
17
21
|
- rvm: ruby-head
|
22
|
+
- rvm: jruby-head
|
23
|
+
- rvm: jruby-19mode
|
24
|
+
- rvm: rbx-19mode
|
18
25
|
notifications:
|
19
26
|
email:
|
20
27
|
on_success: always
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
|
-
Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.7.
|
1
|
+
Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.7.1...master))
|
2
2
|
-------------------
|
3
3
|
|
4
|
+
* [FEATURE] Adds support for Rails 4 command guessing.
|
5
|
+
See [#181](https://github.com/colszowka/simplecov/pull/181) (thanks to @semanticart)
|
6
|
+
* [REFACTORING] Rename adapters to "profiles" given that they are bundles of settings. The old adapter methods are
|
7
|
+
deprecated, but remain available for now.
|
8
|
+
See [#207](https://github.com/colszowka/simplecov/pull/207) (thanks to @mikerobe)
|
9
|
+
* [FEATURE] You can now load simplecov without the default settings by doing `require 'simplecov/no_defaults'
|
10
|
+
or setting `ENV['SIMPLECOV_NO_DEFAULTS']`. Check `simplecov/defaults` to see what preconfigurations are getting
|
11
|
+
dropped by using this.
|
12
|
+
See [#209](https://github.com/colszowka/simplecov/pull/209) (thanks to @ileitch)
|
13
|
+
* [REFACTORING] Tweaks to the automatic test suite naming. In particular, `rspec/features` should now
|
14
|
+
be correctly attributed to RSpec, not Cucumber.
|
15
|
+
See [#212](https://github.com/colszowka/simplecov/pull/212) (thanks to @ersatzryan and @betelgeuse)
|
16
|
+
* [REFACTORING] The internal cucumber test suite now uses Capybara 2.
|
17
|
+
See [#206](https://github.com/colszowka/simplecov/pull/206) (thanks to @infertux)
|
18
|
+
|
4
19
|
v0.7.1, 2012-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...v0.7.1))
|
5
20
|
-------------------
|
6
21
|
|
@@ -170,4 +185,4 @@ v0.5.0, 2011-09-09 ([changes](https://github.com/colszowka/simplecov/compare/v0.
|
|
170
185
|
* The display of source files has been improved a lot. Weird scrolling trouble, out-of-scope line hit counts
|
171
186
|
and such should be a thing of the past. Also, it is prettier now.
|
172
187
|
* Source files are now syntax highlighted
|
173
|
-
* File paths no longer have that annoying './' in front of them
|
188
|
+
* File paths no longer have that annoying './' in front of them
|
data/Gemfile
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
gemspec
|
3
3
|
|
4
|
+
if 'Integration test (cucumber) suite is 1.9+ only'.respond_to? :encoding
|
5
|
+
gem 'aruba', '~> 0.5.1'
|
6
|
+
gem 'capybara', '~> 2.0'
|
7
|
+
gem 'poltergeist', '~> 1.1.0'
|
8
|
+
gem 'phantomjs', '~> 1.8.1'
|
9
|
+
gem 'cucumber', '>= 1.1.0'
|
10
|
+
end
|
11
|
+
|
4
12
|
# Uncomment this to use local copy of simplecov-html in development when checked out
|
5
|
-
# gem 'simplecov-html', :path => File.dirname(__FILE__) + '/../simplecov-html'
|
13
|
+
# gem 'simplecov-html', :path => ::File.dirname(__FILE__) + '/../simplecov-html'
|
14
|
+
|
15
|
+
# Uncomment this to use development version of html formatter from github
|
16
|
+
# gem 'simplecov-html', :github => 'colszowka/simplecov-html'
|
data/{LICENSE → MIT-LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
SimpleCov [][Continuous Integration] [][Dependencies]
|
1
|
+
SimpleCov [][Continuous Integration] [][Dependencies] [](https://codeclimate.com/github/colszowka/simplecov)
|
2
2
|
=========
|
3
3
|
**Code coverage for Ruby 1.9**
|
4
4
|
|
@@ -6,6 +6,7 @@ SimpleCov [
|
|
6
6
|
* [API documentation]
|
7
7
|
* [Changelog]
|
8
8
|
* [Rubygem]
|
9
|
+
* [Mailing List]
|
9
10
|
* [Continuous Integration]
|
10
11
|
|
11
12
|
[Coverage]: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby 1.9's Coverage library"
|
@@ -17,6 +18,7 @@ SimpleCov [
|
|
17
18
|
[Continuous Integration]: http://travis-ci.org/colszowka/simplecov "SimpleCov is built around the clock by travis-ci.org"
|
18
19
|
[Dependencies]: https://gemnasium.com/colszowka/simplecov "SimpleCov dependencies on Gemnasium"
|
19
20
|
[simplecov-html]: https://github.com/colszowka/simplecov-html "SimpleCov HTML Formatter Source Code @ GitHub"
|
21
|
+
[Mailing List]: https://groups.google.com/forum/#!forum/simplecov "Open mailing list for discussion and announcements on Google Groups"
|
20
22
|
[Pledgie]: http://www.pledgie.com/campaigns/18379
|
21
23
|
|
22
24
|
[][Pledgie]
|
@@ -40,43 +42,51 @@ Getting started
|
|
40
42
|
|
41
43
|
1. Add SimpleCov to your `Gemfile` and `bundle install`:
|
42
44
|
|
43
|
-
|
45
|
+
```ruby
|
46
|
+
gem 'simplecov', :require => false, :group => :test
|
47
|
+
```
|
44
48
|
|
45
49
|
2. Load and launch SimpleCov **at the very top** of your `test/test_helper.rb` (*or `spec_helper.rb`, cucumber `env.rb`, or whatever
|
46
50
|
your preferred test framework uses*):
|
47
51
|
|
48
|
-
|
49
|
-
|
52
|
+
```ruby
|
53
|
+
require 'simplecov'
|
54
|
+
SimpleCov.start
|
50
55
|
|
51
|
-
|
56
|
+
# Previous content of test helper now starts here
|
57
|
+
```
|
52
58
|
|
53
|
-
|
54
|
-
|
55
|
-
|
59
|
+
**Note:** If SimpleCov starts after your application code is already loaded (via `require`), it won't be able to
|
60
|
+
track your files and their coverage! The `SimpleCov.start` **must** be issued **before any of your application code
|
61
|
+
is required!**
|
56
62
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
63
|
+
SimpleCov must be running in the process that you want the code coverage analysis to happen on. When testing a server
|
64
|
+
process (i.e. a JSON API endpoint) via a separate test process (i.e. when using Selenium) where you want to see all
|
65
|
+
code executed by the `rails server`, and not just code executed in your actual test files, you'll want to add something
|
66
|
+
like this to the top of `script/rails`:
|
61
67
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
68
|
+
```ruby
|
69
|
+
if ENV['RAILS_ENV'] == 'test'
|
70
|
+
require 'simplecov'
|
71
|
+
SimpleCov.start 'rails'
|
72
|
+
puts "required simplecov"
|
73
|
+
end
|
74
|
+
```
|
67
75
|
|
68
76
|
3. Run your tests, open up `coverage/index.html` in your browser and check out what you've missed so far.
|
69
77
|
|
70
78
|
4. Add the following to your `.gitignore` file to ensure that coverage results are not tracked by Git (optional):
|
71
79
|
|
72
|
-
|
80
|
+
coverage
|
73
81
|
|
74
|
-
If you're making a Rails application, SimpleCov comes with a built-in
|
82
|
+
If you're making a Rails application, SimpleCov comes with a built-in configurations (see below for information on profiles)
|
75
83
|
which will get you started with groups for your Controllers, Views, Models and Helpers. To use it, the first two lines of
|
76
84
|
your test_helper should be like this:
|
77
85
|
|
78
|
-
|
79
|
-
|
86
|
+
```ruby
|
87
|
+
require 'simplecov'
|
88
|
+
SimpleCov.start 'rails'
|
89
|
+
```
|
80
90
|
|
81
91
|
## Example output
|
82
92
|
|
@@ -99,8 +109,10 @@ config to the very top of your Cucumber/RSpec/whatever setup file.
|
|
99
109
|
Add the setup code to the **top** of `features/support/env.rb` (for Cucumber) or `spec/spec_helper.rb` (for RSpec).
|
100
110
|
Other test frameworks should work accordingly, whatever their setup file may be:
|
101
111
|
|
102
|
-
|
103
|
-
|
112
|
+
```ruby
|
113
|
+
require 'simplecov'
|
114
|
+
SimpleCov.start 'rails'
|
115
|
+
```
|
104
116
|
|
105
117
|
You could even track what kind of code your UI testers are touching if you want to go overboard with things. SimpleCov does not
|
106
118
|
care what kind of framework it is running in, it just looks at what code is being executed and generates a report about it.
|
@@ -182,19 +194,25 @@ to use SimpleCov with them. Here's an overview of the known ones:
|
|
182
194
|
|
183
195
|
* The most common way is to configure it directly in your start block:
|
184
196
|
|
185
|
-
|
186
|
-
|
187
|
-
|
197
|
+
```ruby
|
198
|
+
SimpleCov.start do
|
199
|
+
some_config_option 'foo'
|
200
|
+
end
|
201
|
+
```
|
188
202
|
|
189
203
|
* You can also set all configuration options directly:
|
190
204
|
|
191
|
-
|
205
|
+
```ruby
|
206
|
+
SimpleCov.some_config_option 'foo'
|
207
|
+
```
|
192
208
|
|
193
209
|
* If you do not want to start coverage immediately after launch or want to add additional configuration later on in a concise way, use:
|
194
210
|
|
195
|
-
|
196
|
-
|
197
|
-
|
211
|
+
```ruby
|
212
|
+
SimpleCov.configure do
|
213
|
+
some_config_option 'foo'
|
214
|
+
end
|
215
|
+
```
|
198
216
|
|
199
217
|
Please check out the [Configuration] API documentation to find out what you can customize.
|
200
218
|
|
@@ -207,17 +225,18 @@ set up all your config options twice, once in `test_helper.rb` and once in `env.
|
|
207
225
|
To avoid this, you can place a file called `.simplecov` in your project root. You can then just leave the `require 'simplecov'` in each
|
208
226
|
test setup helper and move the `SimpleCov.start` code with all your custom config options into `.simplecov`:
|
209
227
|
|
210
|
-
|
211
|
-
|
228
|
+
```ruby
|
229
|
+
# test/test_helper.rb
|
230
|
+
require 'simplecov'
|
212
231
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
# .simplecov
|
217
|
-
SimpleCov.start 'rails' do
|
218
|
-
# any custom configs like groups and filters can be here at a central place
|
219
|
-
end
|
232
|
+
# features/support/env.rb
|
233
|
+
require 'simplecov'
|
220
234
|
|
235
|
+
# .simplecov
|
236
|
+
SimpleCov.start 'rails' do
|
237
|
+
# any custom configs like groups and filters can be here at a central place
|
238
|
+
end
|
239
|
+
```
|
221
240
|
|
222
241
|
## Filters
|
223
242
|
|
@@ -235,19 +254,23 @@ a block or by passing in your own Filter class.
|
|
235
254
|
|
236
255
|
#### String filter
|
237
256
|
|
238
|
-
|
239
|
-
|
240
|
-
|
257
|
+
```ruby
|
258
|
+
SimpleCov.start do
|
259
|
+
add_filter "/test/"
|
260
|
+
end
|
261
|
+
```
|
241
262
|
|
242
263
|
This simple string filter will remove all files that match "/test/" in their path.
|
243
264
|
|
244
265
|
#### Block filter
|
245
266
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
267
|
+
```ruby
|
268
|
+
SimpleCov.start do
|
269
|
+
add_filter do |source_file|
|
270
|
+
source_file.lines.count < 5
|
271
|
+
end
|
272
|
+
end
|
273
|
+
```
|
251
274
|
|
252
275
|
Block filters receive a SimpleCov::SourceFile instance and expect your block to return either true (if the file is to be removed
|
253
276
|
from the result) or false (if the result should be kept). Please check out the RDoc for SimpleCov::SourceFile to learn about the
|
@@ -255,13 +278,15 @@ methods available to you. In the above example, the filter will remove all files
|
|
255
278
|
|
256
279
|
#### Custom filter class
|
257
280
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
281
|
+
```ruby
|
282
|
+
class LineFilter < SimpleCov::Filter
|
283
|
+
def matches?(source_file)
|
284
|
+
source_file.lines.count < filter_argument
|
285
|
+
end
|
286
|
+
end
|
263
287
|
|
264
|
-
|
288
|
+
SimpleCov.add_filter LineFilter.new(5)
|
289
|
+
```
|
265
290
|
|
266
291
|
Defining your own filters is pretty easy: Just inherit from SimpleCov::Filter and define a method 'matches?(source_file)'. When running
|
267
292
|
the filter, a true return value from this method will result in the removal of the given source_file. The filter_argument method
|
@@ -277,14 +302,16 @@ which exclude files from results when the filter results in a true value.
|
|
277
302
|
|
278
303
|
Add your groups with:
|
279
304
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
305
|
+
```ruby
|
306
|
+
SimpleCov.start do
|
307
|
+
add_group "Models", "app/models"
|
308
|
+
add_group "Controllers", "app/controllers"
|
309
|
+
add_group "Long files" do |src_file|
|
310
|
+
src_file.lines.count > 100
|
311
|
+
end
|
312
|
+
add_group "Short files", LineFilter.new(5) # Using the LineFilter class defined in Filters section above
|
313
|
+
end
|
314
|
+
```
|
288
315
|
|
289
316
|
## Merging results
|
290
317
|
|
@@ -311,17 +338,19 @@ So, to customize the suite names on a Rails app (yeah, sorry for being Rails bia
|
|
311
338
|
the structure of those projects is. You can apply this accordingly to the RSpecs in your Outlook-WebDAV-Calendar-Sync gem),
|
312
339
|
you could do something like this:
|
313
340
|
|
314
|
-
|
315
|
-
|
341
|
+
```ruby
|
342
|
+
# test/unit/some_test.rb
|
343
|
+
SimpleCov.command_name 'test:units'
|
316
344
|
|
317
|
-
|
318
|
-
|
345
|
+
# test/functionals/some_controller_test.rb
|
346
|
+
SimpleCov.command_name "test:functionals"
|
319
347
|
|
320
|
-
|
321
|
-
|
348
|
+
# test/integration/some_integration_test.rb
|
349
|
+
SimpleCov.command_name "test:integration"
|
322
350
|
|
323
|
-
|
324
|
-
|
351
|
+
# features/support/env.rb
|
352
|
+
SimpleCov.command_name "features"
|
353
|
+
```
|
325
354
|
|
326
355
|
Note that this has only to be invoked ONCE PER TEST SUITE, so even if you have 200 unit test files, specifying it in
|
327
356
|
some_test.rb is fair enough.
|
@@ -348,72 +377,85 @@ Because of this, SimpleCov has no explicit built-in mechanism to run coverage on
|
|
348
377
|
|
349
378
|
However, you can still accomplish this very easily by introducing a ENV variable conditional into your SimpleCov setup block, like this:
|
350
379
|
|
351
|
-
|
380
|
+
```ruby
|
381
|
+
SimpleCov.start if ENV["COVERAGE"]
|
382
|
+
```
|
352
383
|
|
353
384
|
Then, SimpleCov will only run if you execute your tests like this:
|
354
385
|
|
355
|
-
|
386
|
+
```shell
|
387
|
+
COVERAGE=true rake test
|
388
|
+
```
|
356
389
|
|
357
390
|
|
358
|
-
##
|
391
|
+
## Profiles
|
359
392
|
|
360
393
|
By default, Simplecov's only config assumption is that you only want coverage reports for files inside your project
|
361
|
-
root. To save you from repetitive configuration, you can use predefined blocks of configuration, called '
|
394
|
+
root. To save you from repetitive configuration, you can use predefined blocks of configuration, called 'profiles',
|
362
395
|
or define your own.
|
363
396
|
|
364
|
-
You can then pass the name of the
|
365
|
-
comes bundled with a 'rails'
|
397
|
+
You can then pass the name of the profile to be used as the first argument to SimpleCov.start. For example, simplecov
|
398
|
+
comes bundled with a 'rails' profile. It looks somewhat like this:
|
366
399
|
|
367
|
-
|
368
|
-
|
369
|
-
|
400
|
+
```ruby
|
401
|
+
SimpleCov.profiles.define 'rails' do
|
402
|
+
add_filter '/test/'
|
403
|
+
add_filter '/config/'
|
370
404
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
405
|
+
add_group 'Controllers', 'app/controllers'
|
406
|
+
add_group 'Models', 'app/models'
|
407
|
+
add_group 'Helpers', 'app/helpers'
|
408
|
+
add_group 'Libraries', 'lib'
|
409
|
+
add_group 'Plugins', 'vendor/plugins'
|
410
|
+
end
|
411
|
+
```
|
377
412
|
|
378
|
-
As you can see, it's just a
|
413
|
+
As you can see, it's just a SimpleCov.configure block. In your test_helper.rb, launch simplecov with:
|
379
414
|
|
380
|
-
|
415
|
+
```ruby
|
416
|
+
SimpleCov.start 'rails'
|
417
|
+
```
|
381
418
|
|
382
419
|
**OR**
|
383
420
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
421
|
+
```ruby
|
422
|
+
SimpleCov.start 'rails' do
|
423
|
+
# additional config here
|
424
|
+
end
|
425
|
+
```
|
389
426
|
|
390
|
-
|
391
|
-
adapter and customize it so you can reuse it in unit tests and cucumber features, for example.
|
427
|
+
### Custom profiles
|
392
428
|
|
393
|
-
|
394
|
-
|
395
|
-
SimpleCov.adapters.define 'myadapter' do
|
396
|
-
load_adapter 'rails'
|
397
|
-
add_filter 'vendor' # Don't include vendored stuff
|
398
|
-
end
|
429
|
+
You can load additional profiles with the SimpleCov.load_profile('xyz') method. This allows you to build upon an existing
|
430
|
+
profile and customize it so you can reuse it in unit tests and cucumber features, for example.
|
399
431
|
|
400
|
-
|
401
|
-
|
402
|
-
|
432
|
+
```ruby
|
433
|
+
# lib/simplecov_custom_profile.rb
|
434
|
+
require 'simplecov'
|
435
|
+
SimpleCov.profiles.define 'myprofile' do
|
436
|
+
load_profile 'rails'
|
437
|
+
add_filter 'vendor' # Don't include vendored stuff
|
438
|
+
end
|
403
439
|
|
404
|
-
|
405
|
-
|
406
|
-
|
440
|
+
# features/support/env.rb
|
441
|
+
require 'simplecov_custom_profile'
|
442
|
+
SimpleCov.start 'myprofile'
|
407
443
|
|
444
|
+
# test/test_helper.rb
|
445
|
+
require 'simplecov_custom_profile'
|
446
|
+
SimpleCov.start 'myprofile'
|
447
|
+
```
|
408
448
|
|
409
449
|
|
410
450
|
## Customizing exit behaviour
|
411
451
|
|
412
452
|
You can define what simplecov should do when your test suite finishes by customizing the at_exit hook:
|
413
453
|
|
414
|
-
|
415
|
-
|
416
|
-
|
454
|
+
```ruby
|
455
|
+
SimpleCov.at_exit do
|
456
|
+
SimpleCov.result.format!
|
457
|
+
end
|
458
|
+
```
|
417
459
|
|
418
460
|
Above is the default behaviour. Do whatever you like instead!
|
419
461
|
|
@@ -421,25 +463,33 @@ Above is the default behaviour. Do whatever you like instead!
|
|
421
463
|
|
422
464
|
You can define the minimum coverage percentage expected. SimpleCov will return non-zero if unmet.
|
423
465
|
|
424
|
-
|
466
|
+
```ruby
|
467
|
+
SimpleCov.minimum_coverage 90
|
468
|
+
```
|
425
469
|
|
426
470
|
### Maximum coverage drop
|
427
471
|
|
428
472
|
You can define the maximum coverage drop percentage at once. SimpleCov will return non-zero if exceeded.
|
429
473
|
|
430
|
-
|
474
|
+
```ruby
|
475
|
+
SimpleCov.maximum_coverage_drop 5
|
476
|
+
```
|
431
477
|
|
432
478
|
### Refuse dropping coverage
|
433
479
|
|
434
480
|
You can also entirely refuse dropping coverage between test runs:
|
435
481
|
|
436
|
-
|
482
|
+
```ruby
|
483
|
+
SimpleCov.refuse_coverage_drop
|
484
|
+
```
|
437
485
|
|
438
486
|
## Using your own formatter
|
439
487
|
|
440
488
|
You can use your own formatter with:
|
441
489
|
|
442
|
-
|
490
|
+
```ruby
|
491
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
492
|
+
```
|
443
493
|
|
444
494
|
When calling SimpleCov.result.format!, it will be invoked with SimpleCov::Formatter::YourFormatter.new.format(result), "result"
|
445
495
|
being an instance of SimpleCov::Result. Do whatever your wish with that!
|
@@ -449,10 +499,12 @@ being an instance of SimpleCov::Result. Do whatever your wish with that!
|
|
449
499
|
|
450
500
|
If you want to use multiple result formats, as of SimpleCov 0.7.0 you can use the built-in MultiFormatter:
|
451
501
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
502
|
+
```ruby
|
503
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
504
|
+
SimpleCov::Formatter::HTMLFormatter,
|
505
|
+
SimpleCov::Formatter::CSVFormatter,
|
506
|
+
]
|
507
|
+
```
|
456
508
|
|
457
509
|
## Available formatters
|
458
510
|
|
@@ -474,6 +526,11 @@ CSV formatter for SimpleCov code coverage tool for ruby 1.9+
|
|
474
526
|
|
475
527
|
A formatter for Simplecov that emits a Vim script to mark up code files with coverage information.
|
476
528
|
|
529
|
+
#### [simplecov-single_file_reporter](https://github.com/grosser/simplecov-single_file_reporter)
|
530
|
+
*by [Michael Grosser](http://grosser.it)*
|
531
|
+
|
532
|
+
A formatter that prints the coverage of the file under test when you run a single test file.
|
533
|
+
|
477
534
|
## Ruby version compatibility
|
478
535
|
|
479
536
|
[](http://travis-ci.org/colszowka/simplecov)
|
@@ -495,4 +552,4 @@ Thanks to Aaron Patterson for the original idea for this!
|
|
495
552
|
|
496
553
|
## Copyright
|
497
554
|
|
498
|
-
Copyright (c) 2010-2012 Christoph Olszowka. See LICENSE for details.
|
555
|
+
Copyright (c) 2010-2012 Christoph Olszowka. See MIT-LICENSE for details.
|