simplecov 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +7 -7
  2. data/.gitignore +0 -1
  3. data/.rubocop.yml +69 -0
  4. data/CHANGELOG.md +39 -22
  5. data/Gemfile +16 -15
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +183 -178
  8. data/Rakefile +16 -7
  9. data/doc/alternate-formatters.md +36 -0
  10. data/doc/commercial-services.md +20 -0
  11. data/doc/editor-integration.md +13 -0
  12. data/features/rspec_basic.feature +3 -2
  13. data/features/rspec_groups_and_filters_complex.feature +2 -0
  14. data/features/rspec_groups_using_filter_class.feature +3 -2
  15. data/features/step_definitions/html_steps.rb +6 -7
  16. data/features/step_definitions/simplecov_steps.rb +18 -16
  17. data/features/step_definitions/transformers.rb +2 -2
  18. data/features/step_definitions/web_steps.rb +4 -4
  19. data/features/support/env.rb +17 -15
  20. data/lib/simplecov.rb +35 -24
  21. data/lib/simplecov/command_guesser.rb +33 -34
  22. data/lib/simplecov/configuration.rb +238 -234
  23. data/lib/simplecov/defaults.rb +37 -36
  24. data/lib/simplecov/exit_codes.rb +7 -5
  25. data/lib/simplecov/file_list.rb +38 -36
  26. data/lib/simplecov/filter.rb +12 -2
  27. data/lib/simplecov/formatter.rb +2 -2
  28. data/lib/simplecov/formatter/simple_formatter.rb +1 -1
  29. data/lib/simplecov/jruby_fix.rb +4 -4
  30. data/lib/simplecov/last_run.rb +15 -13
  31. data/lib/simplecov/merge_helpers.rb +26 -27
  32. data/lib/simplecov/no_defaults.rb +2 -2
  33. data/lib/simplecov/profiles.rb +21 -19
  34. data/lib/simplecov/railtie.rb +1 -1
  35. data/lib/simplecov/railties/tasks.rake +7 -7
  36. data/lib/simplecov/result.rb +5 -5
  37. data/lib/simplecov/result_merger.rb +65 -62
  38. data/lib/simplecov/source_file.rb +23 -24
  39. data/lib/simplecov/version.rb +20 -1
  40. data/simplecov.gemspec +14 -12
  41. data/test/faked_project/Gemfile +5 -5
  42. data/test/faked_project/Rakefile +4 -4
  43. data/test/faked_project/features/step_definitions/my_steps.rb +3 -4
  44. data/test/faked_project/features/support/env.rb +5 -5
  45. data/test/faked_project/lib/faked_project.rb +1 -1
  46. data/test/faked_project/lib/faked_project/some_class.rb +3 -4
  47. data/test/faked_project/spec/faked_spec.rb +2 -2
  48. data/test/faked_project/spec/forking_spec.rb +7 -0
  49. data/test/faked_project/spec/meta_magic_spec.rb +1 -1
  50. data/test/faked_project/spec/some_class_spec.rb +3 -3
  51. data/test/faked_project/spec/spec_helper.rb +4 -8
  52. data/test/faked_project/test/faked_test.rb +2 -2
  53. data/test/faked_project/test/meta_magic_test.rb +1 -1
  54. data/test/faked_project/test/some_class_test.rb +3 -3
  55. data/test/faked_project/test/test_helper.rb +5 -9
  56. data/test/fixtures/app/controllers/sample_controller.rb +1 -1
  57. data/test/fixtures/app/models/user.rb +1 -1
  58. data/test/fixtures/deleted_source_sample.rb +3 -3
  59. data/test/fixtures/frameworks/rspec_bad.rb +4 -4
  60. data/test/fixtures/frameworks/rspec_good.rb +4 -4
  61. data/test/fixtures/frameworks/testunit_bad.rb +3 -3
  62. data/test/fixtures/frameworks/testunit_good.rb +3 -3
  63. data/test/fixtures/resultset2.rb +0 -1
  64. data/test/fixtures/sample.rb +1 -1
  65. data/test/fixtures/utf-8.rb +1 -1
  66. data/test/helper.rb +8 -8
  67. data/test/test_1_8_fallbacks.rb +6 -6
  68. data/test/test_command_guesser.rb +7 -7
  69. data/test/test_deleted_source.rb +2 -2
  70. data/test/test_file_list.rb +8 -6
  71. data/test/test_filters.rb +29 -13
  72. data/test/test_merge_helpers.rb +26 -23
  73. data/test/test_result.rb +32 -23
  74. data/test/test_return_codes.rb +3 -3
  75. data/test/test_source_file.rb +4 -4
  76. data/test/test_source_file_line.rb +13 -13
  77. metadata +145 -63
  78. data/lib/simplecov/json.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 07f4eeb02f67a4fbdaf56965216632e34daac2c5
4
- data.tar.gz: c3a90e5ed935a4781703d9076c63e7f1e6077f8e
5
- SHA512:
6
- metadata.gz: 58701d69e85eea76441b0b3bc61cf2c0949d69373d110a3a560359584c0a23a398cefdd0ae9cfb259ea3204ac94b1dbf791d3bebbbfc6c42d3cf4bebadc571ac
7
- data.tar.gz: 87c5c258ed9415afc45bbf726bd1415c199761718ccfaa090100fc9cee4739277fde72a6deb9d3f7f73370f28378dcc50a280c11e81bbda1768091f4625d88ef
1
+ ---
2
+ SHA512:
3
+ metadata.gz: 48711e9d1476719d339f0086b8f35b64be59364bbbf5c0d3c767c56a7857dd1afa576b05278a1c74aa8a346d97817676eef1d48f3f10ec1e8b4e452fc4445f56
4
+ data.tar.gz: 88dad87cce15389b66baa7d2bb73f675fe168e2dd4168fef863310b053cf989a10a1fdced39b2d10616e8187c48d342236da8e0e17e915d34b4588da949737a2
5
+ SHA1:
6
+ metadata.gz: ce56b638173500ad25afd14ce524ff192753fc7e
7
+ data.tar.gz: 5279e97dae54994a96c976917ce820c5af60cbcb
data/.gitignore CHANGED
@@ -29,4 +29,3 @@ capybara*.html
29
29
  ## PROJECT::SPECIFIC
30
30
 
31
31
  .yardoc
32
- doc
@@ -0,0 +1,69 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'test/fixtures/iso-8859.rb'
4
+ - 'tmp/**/*'
5
+ - 'vendor/bundle/**/*'
6
+
7
+ Lint/AmbiguousRegexpLiteral:
8
+ Exclude:
9
+ - 'features/**/*_steps.rb'
10
+ - 'test/**/*_steps.rb'
11
+ - 'tmp/**/*_steps.rb'
12
+
13
+ Metrics/AbcSize:
14
+ Max: 25 # TODO: Lower to 15
15
+
16
+ Metrics/BlockNesting:
17
+ Max: 2
18
+
19
+ Metrics/LineLength:
20
+ AllowURI: true
21
+ Enabled: false
22
+
23
+ Metrics/MethodLength:
24
+ CountComments: false
25
+ Max: 12 # TODO: Lower to 10
26
+
27
+ Metrics/ParameterLists:
28
+ Max: 4
29
+ CountKeywordArgs: true
30
+
31
+ Style/AccessModifierIndentation:
32
+ EnforcedStyle: outdent
33
+
34
+ Style/CollectionMethods:
35
+ PreferredMethods:
36
+ map: 'collect'
37
+ reduce: 'inject'
38
+ find: 'detect'
39
+ find_all: 'select'
40
+
41
+ Style/Documentation:
42
+ Enabled: false
43
+
44
+ Style/DoubleNegation:
45
+ Enabled: false
46
+
47
+ Style/HashSyntax:
48
+ EnforcedStyle: hash_rockets
49
+
50
+ Style/RegexpLiteral:
51
+ Enabled: false
52
+
53
+ Style/SpaceInsideHashLiteralBraces:
54
+ EnforcedStyle: no_space
55
+
56
+ Style/SpecialGlobalVars:
57
+ Exclude:
58
+ - 'test/test_deleted_source.rb'
59
+ - 'test/test_return_codes.rb'
60
+
61
+ Style/StringLiterals:
62
+ EnforcedStyle: double_quotes
63
+
64
+ Style/FileName:
65
+ Exclude:
66
+ - 'test/fixtures/utf-8.rb'
67
+
68
+ Style/TrailingComma:
69
+ EnforcedStyleForMultiline: 'comma'
@@ -1,17 +1,34 @@
1
- Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.9.2...master))
2
- ====================
1
+ Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.10.0...master))
2
+ =================
3
3
 
4
4
  ## Enhancements
5
5
 
6
6
  ## Bugfixes
7
7
 
8
+ 0.10.0 2015-04-18 ([changes](https://github.com/colszowka/simplecov/compare/v0.9.2...0.10.0))
9
+ =================
10
+
11
+ ## Enhancements
12
+
13
+ * Add writeup about using with Spring to README. See [#341](https://github.com/colszowka/simplecov/issues/341) (thanks @swrobel and @onebree)
14
+ * Add support to pass in an Array when creating filter groups (original PR #104)
15
+ * Filter `/vendor/bundle` by default. See [#331](https://github.com/colszowka/simplecov/pull/331) (thanks @andyw8)
16
+ * Add some helpful singleton methods to the version string.
17
+ * Allow array to be passed in a filter. See [375](https://github.com/colszowka/simplecov/pull/375) (thanks @JanStevens)
18
+ * Enforce consistent code formatting with RuboCop.
19
+
20
+ ## Bugfixes
21
+
22
+ * Fix order dependencies in unit tests. See [#376](https://github.com/colszowka/simplecov/pull/376) (thanks @hugopeixoto)
23
+ * 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)
24
+
8
25
  0.9.2, 2015-02-18 ([changes](https://github.com/colszowka/simplecov/compare/v0.9.1...v0.9.2))
9
- ====================
26
+ =================
10
27
 
11
28
  This is a minor bugfix release for simplecov-html, released as `0.9.0`. Due to the tight version constraint in the gemspec
12
29
  a new release of simplecov had to be shipped to allow using simplecov-html `~> 0.9.0`.
13
30
 
14
- * The browser back / forward button should now work again. See [#36](https://github.com/colszowka/simplecov-html/pull/36) and
31
+ * The browser back / forward button should now work again. See [#36](https://github.com/colszowka/simplecov-html/pull/36) and
15
32
  [#35](https://github.com/colszowka/simplecov-html/pull/35). Thanks @whatasunnyday and @justinsteele for submitting PRs to fix this.
16
33
  * Fix "warning: possibly useless use of a variable in void context" See [#31](https://github.com/colszowka/simplecov-html/pull/31). Thanks @cbandy
17
34
  * Always use binary file format. See [#32](https://github.com/colszowka/simplecov-html/pull/32). Thanks @andy128k
@@ -28,7 +45,7 @@ Other than the release includes a bunch of mostly documentation improvements:
28
45
 
29
46
 
30
47
  0.9.1, 2014-09-21 ([changes](https://github.com/colszowka/simplecov/compare/v0.9.0...v0.9.1))
31
- ====================
48
+ =================
32
49
 
33
50
  ## Bugfixes
34
51
 
@@ -38,7 +55,7 @@ Other than the release includes a bunch of mostly documentation improvements:
38
55
 
39
56
 
40
57
  0.9.0, 2014-07-17 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.2...v0.9.0))
41
- ====================
58
+ =================
42
59
 
43
60
  **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!**
44
61
 
@@ -74,7 +91,7 @@ Other than the release includes a bunch of mostly documentation improvements:
74
91
  See [#311](https://github.com/colszowka/simplecov/pull/311) (thanks @lasseebert)
75
92
 
76
93
  v0.8.2, 2013-11-20 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.1...v0.8.2))
77
- =====================
94
+ ==================
78
95
 
79
96
  ## Bugfixes
80
97
 
@@ -85,7 +102,7 @@ v0.8.2, 2013-11-20 ([changes](https://github.com/colszowka/simplecov/compare/v0.
85
102
  [#223](https://github.com/colszowka/simplecov/pull/223) (thanks to @tomykaira)
86
103
 
87
104
  v0.8.1, 2013-11-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.8.0...v0.8.1))
88
- =====================
105
+ ==================
89
106
 
90
107
  ## Bugfixes
91
108
 
@@ -93,7 +110,7 @@ v0.8.1, 2013-11-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.
93
110
  See [#256](https://github.com/colszowka/simplecov/pull/256) (thanks to @kylev)
94
111
 
95
112
  v0.8.0, 2013-11-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.7.1...v0.8.0))
96
- =====================
113
+ ==================
97
114
 
98
115
  **Note: Yanked the same day because of the regression that 0.8.1 fixes, see above**
99
116
 
@@ -166,7 +183,7 @@ has been added.
166
183
  [#237](https://github.com/colszowka/simplecov/pull/237) (thanks to @rli9)
167
184
 
168
185
  v0.7.1, 2012-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.7.0...v0.7.1))
169
- =====================
186
+ ==================
170
187
 
171
188
  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
172
189
  permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
@@ -176,7 +193,7 @@ v0.7.1, 2012-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.
176
193
 
177
194
 
178
195
  v0.7.0, 2012-10-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.4...v0.7.0))
179
- =====================
196
+ ==================
180
197
 
181
198
  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
182
199
  coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
@@ -195,7 +212,7 @@ v0.7.0, 2012-10-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.
195
212
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
196
213
 
197
214
  v0.6.4, 2012-05-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.3...v0.6.4))
198
- =====================
215
+ ==================
199
216
 
200
217
  * [BUGFIX] Encoding issues with ISO-8859-encoded source files fixed.
201
218
  See https://github.com/colszowka/simplecov/pull/117. (thanks to @Deradon)
@@ -207,7 +224,7 @@ v0.6.4, 2012-05-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.
207
224
 
208
225
 
209
226
  v0.6.3, 2012-05-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.2...v0.6.3))
210
- =====================
227
+ ==================
211
228
 
212
229
  * [BUGFIX] Modified the API-changes for newer multi_json versions introduced with #122 and v0.6.2 so
213
230
  they are backwards-compatible with older multi_json gems in order to avoid simplecov polluting
@@ -217,19 +234,19 @@ v0.6.3, 2012-05-10 ([changes](https://github.com/colszowka/simplecov/compare/v0.
217
234
  multi_json gems and ensure the above actually works :)
218
235
 
219
236
  v0.6.2, 2012-04-20 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.1...v0.6.2))
220
- =====================
237
+ ==================
221
238
 
222
239
  * [Updated to latest version of MultiJSON and its new API (thanks to @sferik and @ronen).
223
240
  See https://github.com/colszowka/simplecov/pull/122
224
241
 
225
242
  v0.6.1, 2012-02-24 ([changes](https://github.com/colszowka/simplecov/compare/v0.6.0...v0.6.1))
226
- =====================
243
+ ==================
227
244
 
228
245
  * [BUGFIX] Don't force-load Railtie on Rails < 3. Fixes regression introduced with
229
246
  #83. See https://github.com/colszowka/simplecov/issues/113
230
247
 
231
248
  v0.6.0, 2012-02-22 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.4...v0.6.0))
232
- =====================
249
+ ==================
233
250
 
234
251
  * [FEATURE] Auto-magic `rake simplecov` task for rails
235
252
  (see https://github.com/colszowka/simplecov/pull/83, thanks @sunaku)
@@ -245,7 +262,7 @@ v0.6.0, 2012-02-22 ([changes](https://github.com/colszowka/simplecov/compare/v0.
245
262
  list of changes: https://github.com/colszowka/simplecov/compare/v0.5.4...v0.6.0
246
263
 
247
264
  v0.5.4, 2011-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.3...v0.5.4))
248
- =====================
265
+ ==================
249
266
 
250
267
  * Do not give exit code 0 when there are exceptions prior to tests
251
268
  (see https://github.com/colszowka/simplecov/issues/41, thanks @nbogie)
@@ -258,7 +275,7 @@ v0.5.4, 2011-10-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.
258
275
  * Readme formatted in Markdown :)
259
276
 
260
277
  v0.5.3, 2011-09-13 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.2...v0.5.3))
261
- =====================
278
+ ==================
262
279
 
263
280
  * Fix for encoding issues that came from the nocov processing mechanism
264
281
  (see https://github.com/colszowka/simplecov/issues/71)
@@ -273,13 +290,13 @@ v0.5.3, 2011-09-13 ([changes](https://github.com/colszowka/simplecov/compare/v0.
273
290
  alias SimpleCov.skip_token)
274
291
 
275
292
  v0.5.2, 2011-09-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.1...v0.5.2))
276
- =====================
293
+ ==================
277
294
 
278
295
  * Another fix for a bug in JSON processing introduced with MultiJSON in 0.5.1
279
296
  (see https://github.com/colszowka/simplecov/pull/75, thanks @sferik)
280
297
 
281
298
  v0.5.1, 2011-09-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.5.0...v0.5.1))
282
- =====================
299
+ ==================
283
300
  **Note: Yanked 2011-09-12 because the MultiJSON-patch had a crucial bug**
284
301
 
285
302
  * Fix for invalid gemspec dependency string (see https://github.com/colszowka/simplecov/pull/70,
@@ -290,7 +307,7 @@ v0.5.1, 2011-09-12 ([changes](https://github.com/colszowka/simplecov/compare/v0.
290
307
  and https://github.com/colszowka/simplecov/pull/74, thanks @sferik)
291
308
 
292
309
  v0.5.0, 2011-09-09 ([changes](https://github.com/colszowka/simplecov/compare/v0.4.2...v0.5.4))
293
- =====================
310
+ ==================
294
311
  **Note: Yanked 2011-09-09 because of trouble with the gemspec.**
295
312
 
296
313
  * JSON is now used instead of YAML for resultset caching (used for merging). Should resolve
@@ -311,7 +328,7 @@ v0.5.0, 2011-09-09 ([changes](https://github.com/colszowka/simplecov/compare/v0.
311
328
  <pre>
312
329
  #:nocov:
313
330
  def skipped
314
- @foo * 2
331
+ @foo * 2
315
332
  end
316
333
  #:nocov:
317
334
  </pre>
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Uncomment this to use local copy of simplecov-html in development when checked out
4
4
  # gem 'simplecov-html', :path => ::File.dirname(__FILE__) + '/../simplecov-html'
@@ -6,28 +6,29 @@ source 'https://rubygems.org'
6
6
  # Uncomment this to use development version of html formatter from github
7
7
  # gem 'simplecov-html', :github => 'colszowka/simplecov-html'
8
8
 
9
- gem 'rake', '>= 10.3'
9
+ gem "rake", ">= 10.3"
10
10
 
11
11
  group :test do
12
12
  # Older versions of some gems required for Ruby 1.8.7 support
13
13
  platform :ruby_18 do
14
- gem 'activesupport', '~> 3.2.21'
15
- gem 'shoulda-matchers', '~> 2.0.0'
16
- gem 'i18n', '~> 0.6.11'
14
+ gem "activesupport", "~> 3.2.21"
15
+ gem "shoulda-matchers", "~> 2.0.0"
16
+ gem "i18n", "~> 0.6.11"
17
17
  end
18
- gem 'minitest', '>= 5.5'
19
- gem 'rspec', '>= 3.0'
20
- gem 'rspec-legacy_formatters', '>= 1.0'
21
- gem 'shoulda', '>= 3.5'
18
+ gem "rubocop", ">= 0.30", :platforms => [:ruby_19, :ruby_20, :ruby_21, :ruby_22]
19
+ gem "minitest", ">= 5.5"
20
+ gem "rspec", ">= 3.0"
21
+ gem "rspec-legacy_formatters", ">= 1.0"
22
+ gem "shoulda", ">= 3.5"
22
23
  end
23
24
 
24
25
  platform :jruby, :ruby_19, :ruby_20, :ruby_21, :ruby_22 do
25
- gem 'aruba', '~> 0.6'
26
- gem 'capybara', '~> 2.0.0'
27
- gem 'cucumber', '~> 1.1'
28
- gem 'phantomjs', '~> 1.9'
29
- gem 'poltergeist', '~> 1.1'
30
- gem 'test-unit', '~> 3.0'
26
+ gem "aruba", "~> 0.6"
27
+ gem "capybara", "~> 2.0.0"
28
+ gem "cucumber", "~> 2.0"
29
+ gem "phantomjs", "~> 1.9"
30
+ gem "poltergeist", "~> 1.1"
31
+ gem "test-unit", "~> 3.0"
31
32
  end
32
33
 
33
34
  gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2013 Christoph Olszowka
1
+ Copyright (c) 2010-2015 Christoph Olszowka
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -9,7 +9,7 @@ SimpleCov [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)
9
9
  * [Mailing List]
10
10
  * [Continuous Integration]
11
11
 
12
- **Important Notice: There is a bug that affects exit code handling on the 0.8 line of SimpleCov, see [#281](https://github.com/colszowka/simplecov/issues/281). Please use versions `~> 0.9.0` to avoid this.**
12
+ **Important Notice: There is a bug that affects exit code handling on the 0.8 line of SimpleCov, see [#281](https://github.com/colszowka/simplecov/issues/281). Please use versions `>= 0.9` to avoid this.**
13
13
 
14
14
  [Coverage]: http://www.ruby-doc.org/stdlib-2.1.0/libdoc/coverage/rdoc/Coverage.html "API doc for Ruby's Coverage library"
15
15
  [Source Code]: https://github.com/colszowka/simplecov "Source Code @ GitHub"
@@ -43,7 +43,7 @@ automatically when you launch SimpleCov. If you're curious, you can find it [on
43
43
  *Code and Bug Reports*
44
44
 
45
45
  * [Issue Tracker](https://github.com/colszowka/simplecov/issues)
46
- * 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.
46
+ * 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.
47
47
 
48
48
  *Questions, Problems, Suggestions, etc.*
49
49
 
@@ -51,54 +51,58 @@ automatically when you launch SimpleCov. If you're curious, you can find it [on
51
51
 
52
52
  Getting started
53
53
  ---------------
54
-
55
54
  1. Add SimpleCov to your `Gemfile` and `bundle install`:
56
55
 
57
- ```ruby
58
- gem 'simplecov', :require => false, :group => :test
59
- ```
60
-
61
- 2. Load and launch SimpleCov **at the very top** of your `test/test_helper.rb` (*or `spec_helper.rb`, cucumber `env.rb`, or whatever
62
- your preferred test framework uses*):
63
-
64
- ```ruby
65
- require 'simplecov'
66
- SimpleCov.start
67
-
68
- # Previous content of test helper now starts here
69
- ```
70
-
71
- **Note:** If SimpleCov starts after your application code is already loaded (via `require`), it won't be able to
72
- track your files and their coverage! The `SimpleCov.start` **must** be issued **before any of your application code
73
- is required!**
74
-
75
- SimpleCov must be running in the process that you want the code coverage analysis to happen on. When testing a server
76
- process (i.e. a JSON API endpoint) via a separate test process (i.e. when using Selenium) where you want to see all
77
- code executed by the `rails server`, and not just code executed in your actual test files, you'll want to add something
78
- like this to the top of `script/rails` (or `bin/rails` for Rails 4.*):
79
-
80
- ```ruby
81
- if ENV['RAILS_ENV'] == 'test'
82
- require 'simplecov'
83
- SimpleCov.start 'rails'
84
- puts "required simplecov"
85
- end
86
- ```
87
-
88
- 3. Run your tests, open up `coverage/index.html` in your browser and check out what you've missed so far.
89
-
90
- 4. Add the following to your `.gitignore` file to ensure that coverage results are not tracked by Git (optional):
91
-
56
+ ```ruby
57
+ gem 'simplecov', :require => false, :group => :test
58
+ ```
59
+ 2. Load and launch SimpleCov **at the very top** of your `test/test_helper.rb`
60
+ (*or `spec_helper.rb`, cucumber `env.rb`, or whatever your preferred test
61
+ framework uses*):
62
+
63
+ ```ruby
64
+ require 'simplecov'
65
+ SimpleCov.start
66
+
67
+ # Previous content of test helper now starts here
68
+ ```
69
+
70
+ **Note:** If SimpleCov starts after your application code is already loaded
71
+ (via `require`), it won't be able to track your files and their coverage!
72
+ The `SimpleCov.start` **must** be issued **before any of your application
73
+ code is required!**
74
+
75
+ SimpleCov must be running in the process that you want the code coverage
76
+ analysis to happen on. When testing a server process (i.e. a JSON API
77
+ endpoint) via a separate test process (i.e. when using Selenium) where you
78
+ want to see all code executed by the `rails server`, and not just code
79
+ executed in your actual test files, you'll want to add something like this
80
+ to the top of `script/rails` (or `bin/rails` for Rails 4):
81
+
82
+ ```ruby
83
+ if ENV['RAILS_ENV'] == 'test'
84
+ require 'simplecov'
85
+ SimpleCov.start 'rails'
86
+ puts "required simplecov"
87
+ end
88
+ ```
89
+ 3. Run your tests, open up `coverage/index.html` in your browser and check out
90
+ what you've missed so far.
91
+ 4. Add the following to your `.gitignore` file to ensure that coverage results
92
+ are not tracked by Git (optional):
93
+
94
+ ```
92
95
  coverage
96
+ ```
93
97
 
94
- If you're making a Rails application, SimpleCov comes with built-in configurations (see below for information on profiles)
95
- that will get you started with groups for your Controllers, Views, Models and Helpers. To use it, the first two lines of
96
- your test_helper should be like this:
98
+ If you're making a Rails application, SimpleCov comes with built-in configurations (see below for information on profiles)
99
+ that will get you started with groups for your Controllers, Views, Models and Helpers. To use it, the first two lines of
100
+ your test_helper should be like this:
97
101
 
98
- ```ruby
99
- require 'simplecov'
100
- SimpleCov.start 'rails'
101
- ```
102
+ ```ruby
103
+ require 'simplecov'
104
+ SimpleCov.start 'rails'
105
+ ```
102
106
 
103
107
  ## Example output
104
108
 
@@ -111,8 +115,6 @@ SimpleCov.start 'rails'
111
115
 
112
116
  ![SimpleCov source file detail view](http://colszowka.github.com/simplecov/devise_source_file-0.5.3.png)
113
117
 
114
-
115
-
116
118
  ## Use it with any framework!
117
119
 
118
120
  Similarly to the usage with Test::Unit described above, the only thing you have to do is to add the SimpleCov
@@ -135,71 +137,88 @@ For some frameworks and testing tools there are quirks and problems you might wa
135
137
  to use SimpleCov with them. Here's an overview of the known ones:
136
138
 
137
139
  <table>
138
- <tr><th>Framework</th><th>Notes</th><th>Issue #</th></tr>
139
- <tr>
140
- <td>
141
- <b>Test/Unit 2</b>
142
- </td>
143
- <td>
144
- Test Unit 2 used to mess with ARGV, leading to a failure to detect the test process name in SimpleCov.
145
- <code>test-unit</code> releases 2.4.3+ (Dec 11th, 2011) should have this problem resolved.
146
- </td>
147
- <td>
148
- <a href="https://github.com/colszowka/simplecov/issues/45">SimpleCov #45</a> &
149
- <a href="https://github.com/test-unit/test-unit/pull/12">Test/Unit #12</a>
150
- </td>
151
- </tr>
152
- <tr>
153
- <td>
154
- <b>Spork</b>
155
- </td>
156
- <td>
157
- Because of how Spork works internally (using preforking), there used to be trouble when using SimpleCov
158
- with it, but that has apparently been resolved with a specific configuration strategy. See
159
- <a href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">this</a> comment.
160
- </td>
161
- <td>
162
- <a href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">SimpleCov #42</a>
163
- </td>
164
- </tr>
165
- <tr>
166
- <td>
167
- <b>parallel_tests</b>
168
- </td>
169
- <td>
170
- As of 0.8.0, SimpleCov should correctly recognize parallel_tests and supplement your test suite names
171
- with their corresponding test env numbers. Locking of the resultset cache should ensure no race conditions
172
- occur when results are merged.
173
- </td>
174
- <td>
175
- <a href="https://github.com/colszowka/simplecov/issues/64">SimpleCov #64</a>
176
- <a href="https://github.com/colszowka/simplecov/pull/185">SimpleCov #185</a>
177
- </td>
178
- </tr>
179
- <tr>
180
- <td>
181
- <b>Riot</b>
182
- </td>
183
- <td>
184
- A user has reported problems with the coverage report using the riot framework. If you experience
185
- similar trouble please follow up on the related GitHub issue.
186
- </td>
187
- <td>
188
- <a href="https://github.com/colszowka/simplecov/issues/80">SimpleCov #80</a>
189
- </td>
190
- </tr>
191
- <tr>
192
- <td>
193
- <b>RubyMine</b>
194
- </td>
195
- <td>
196
- The <a href="https://www.jetbrains.com/ruby/">RubyMine IDE</a> has built-in support for SimpleCov's coverage reports,
197
- though you might need to explicitly set the output root using `SimpleCov.root('foo/bar/baz')`
198
- </td>
199
- <td>
200
- <a href="https://github.com/colszowka/simplecov/issues/95">SimpleCov #95</a>
201
- </td>
202
- </tr>
140
+ <tr><th>Framework</th><th>Notes</th><th>Issue</th></tr>
141
+ <tr>
142
+ <th>
143
+ parallel_tests
144
+ </th>
145
+ <td>
146
+ As of 0.8.0, SimpleCov should correctly recognize parallel_tests and
147
+ supplement your test suite names with their corresponding test env
148
+ numbers. Locking of the resultset cache should ensure no race conditions
149
+ occur when results are merged.
150
+ </td>
151
+ <td>
152
+ <a href="https://github.com/colszowka/simplecov/issues/64">#64</a> &amp;
153
+ <a href="https://github.com/colszowka/simplecov/pull/185">#185</a>
154
+ </td>
155
+ </tr>
156
+ <tr>
157
+ <th>
158
+ Riot
159
+ </th>
160
+ <td>
161
+ A user has reported problems with the coverage report using the riot
162
+ framework. If you experience similar trouble please follow up on the
163
+ related GitHub issue.
164
+ </td>
165
+ <td>
166
+ <a href="https://github.com/colszowka/simplecov/issues/80">#80</a>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <th>
171
+ RubyMine
172
+ </th>
173
+ <td>
174
+ The <a href="https://www.jetbrains.com/ruby/">RubyMine IDE</a> has
175
+ built-in support for SimpleCov's coverage reports, though you might need
176
+ to explicitly set the output root using `SimpleCov.root('foo/bar/baz')`
177
+ </td>
178
+ <td>
179
+ <a href="https://github.com/colszowka/simplecov/issues/95">#95</a>
180
+ </td>
181
+ </tr>
182
+ <tr>
183
+ <th>
184
+ Spork
185
+ </th>
186
+ <td>
187
+ Because of how Spork works internally (using preforking), there used to
188
+ be trouble when using SimpleCov with it, but that has apparently been
189
+ resolved with a specific configuration strategy. See <a
190
+ href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">this</a>
191
+ comment.
192
+ </td>
193
+ <td>
194
+ <a href="https://github.com/colszowka/simplecov/issues/42#issuecomment-4440284">#42</a>
195
+ </td>
196
+ </tr>
197
+ <tr>
198
+ <th>
199
+ Spring
200
+ </th>
201
+ <td>
202
+ <a href="#want-to-use-spring-with-simplecov">See section below.</a>
203
+ </td>
204
+ <td>
205
+ <a href="https://github.com/colszowka/simplecov/issues/381">#381</a>
206
+ </td>
207
+ </tr>
208
+ <tr>
209
+ <th>
210
+ Test/Unit
211
+ </th>
212
+ <td>
213
+ Test Unit 2 used to mess with ARGV, leading to a failure to detect the
214
+ test process name in SimpleCov. <code>test-unit</code> releases 2.4.3+
215
+ (Dec 11th, 2011) should have this problem resolved.
216
+ </td>
217
+ <td>
218
+ <a href="https://github.com/colszowka/simplecov/issues/45">#45</a> &amp;
219
+ <a href="https://github.com/test-unit/test-unit/pull/12">test-unit/test-unit#12</a>
220
+ </td>
221
+ </tr>
203
222
  </table>
204
223
 
205
224
  ## Configuring SimpleCov
@@ -208,29 +227,26 @@ to use SimpleCov with them. Here's an overview of the known ones:
208
227
 
209
228
  * The most common way is to configure it directly in your start block:
210
229
 
211
- ```ruby
212
- SimpleCov.start do
213
- some_config_option 'foo'
214
- end
215
- ```
216
-
230
+ ```ruby
231
+ SimpleCov.start do
232
+ some_config_option 'foo'
233
+ end
234
+ ```
217
235
  * You can also set all configuration options directly:
218
236
 
219
- ```ruby
220
- SimpleCov.some_config_option 'foo'
221
- ```
222
-
237
+ ```ruby
238
+ SimpleCov.some_config_option 'foo'
239
+ ```
223
240
  * If you do not want to start coverage immediately after launch or want to add additional configuration later on in a concise way, use:
224
241
 
225
- ```ruby
226
- SimpleCov.configure do
227
- some_config_option 'foo'
228
- end
229
- ```
242
+ ```ruby
243
+ SimpleCov.configure do
244
+ some_config_option 'foo'
245
+ end
246
+ ```
230
247
 
231
248
  Please check out the [Configuration] API documentation to find out what you can customize.
232
249
 
233
-
234
250
  ## Using .simplecov for centralized config
235
251
 
236
252
  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
@@ -334,7 +350,7 @@ that shows how you can achieve just that:
334
350
 
335
351
  ```ruby
336
352
  SimpleCov.start :rails do
337
- filters.clear # This will remove the :root_filter that comes via simplecov's defaults
353
+ filters.clear # This will remove the :root_filter and :bundler_filter that come via simplecov's defaults
338
354
  add_filter do |src|
339
355
  !(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /my_engine/
340
356
  end
@@ -357,6 +373,7 @@ SimpleCov.start do
357
373
  add_group "Long files" do |src_file|
358
374
  src_file.lines.count > 100
359
375
  end
376
+ add_group "Multiple Files", ["app/models", "app/controllers"] # You can also pass in an array
360
377
  add_group "Short files", LineFilter.new(5) # Using the LineFilter class defined in Filters section above
361
378
  end
362
379
  ```
@@ -425,7 +442,6 @@ just `merge_timeout 3600`.
425
442
 
426
443
  You can deactivate merging altogether with `SimpleCov.use_merging false`.
427
444
 
428
-
429
445
  ## Running coverage only on demand
430
446
 
431
447
  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
@@ -446,7 +462,6 @@ Then, SimpleCov will only run if you execute your tests like this:
446
462
  COVERAGE=true rake test
447
463
  ```
448
464
 
449
-
450
465
  ## Profiles
451
466
 
452
467
  By default, SimpleCov's only config assumption is that you only want coverage reports for files inside your project
@@ -474,7 +489,7 @@ As you can see, it's just a SimpleCov.configure block. In your test_helper.rb, l
474
489
  SimpleCov.start 'rails'
475
490
  ```
476
491
 
477
- **OR**
492
+ or
478
493
 
479
494
  ```ruby
480
495
  SimpleCov.start 'rails' do
@@ -504,7 +519,6 @@ require 'simplecov_custom_profile'
504
519
  SimpleCov.start 'myprofile'
505
520
  ```
506
521
 
507
-
508
522
  ## Customizing exit behaviour
509
523
 
510
524
  You can define what SimpleCov should do when your test suite finishes by customizing the at_exit hook:
@@ -555,7 +569,7 @@ being an instance of SimpleCov::Result. Do whatever your wish with that!
555
569
 
556
570
  ## Using multiple formatters
557
571
 
558
- As for SimpleCov 0.9.0, you can specify multiple result formats:
572
+ As of SimpleCov 0.9, you can specify multiple result formats:
559
573
 
560
574
  ```ruby
561
575
  SimpleCov.formatters = [
@@ -564,60 +578,51 @@ SimpleCov.formatters = [
564
578
  ]
565
579
  ```
566
580
 
567
- ## Available formatters
568
-
569
- Apart from the direct companion [simplecov-html], there are other formatters
570
- available:
571
-
572
- #### [simplecov-rcov](https://github.com/fguillen/simplecov-rcov)
573
- *by Fernando Guillen*
574
-
575
- "The target of this formatter is to cheat on Hudson so I can use the Ruby metrics plugin with SimpleCov."
581
+ ## Available formatters, editor integrations and hosted services
576
582
 
577
- #### [simplecov-csv](https://github.com/fguillen/simplecov-csv)
578
- *by Fernando Guillen*
583
+ * [Open Source formatter and integration plugins for SimpleCov](doc/alternate-formatters.md)
584
+ * [Editor Integration](doc/editor-integration.md)
585
+ * [Hosted (commercial) services](doc/commercial-services.md)
579
586
 
580
- CSV formatter for SimpleCov
581
-
582
- #### [cadre](https://github.com/nyarly/cadre)
583
- *by Judson Lester*
584
-
585
- Includes a formatter for Simplecov that emits a Vim script to mark up code files with coverage information.
586
-
587
- #### [simplecov-single_file_reporter](https://github.com/grosser/simplecov-single_file_reporter)
588
- *by [Michael Grosser](http://grosser.it)*
589
-
590
- A formatter that prints the coverage of the file under test when you run a single test file.
591
-
592
- #### [simplecov-json](https://github.com/vicentllongo/simplecov-json)
593
- *by Vicent Llongo*
594
-
595
- JSON formatter for SimpleCov
596
-
597
- #### [simplecov-badge](https://github.com/matthew342/simplecov-badge)
598
- *by Matt Hale*
587
+ ## Ruby version compatibility
599
588
 
600
- A formatter that generates a coverage badge for use in your project's readme using ImageMagick.
589
+ Only Ruby 1.9+ ships with the coverage library that SimpleCov depends upon.
590
+ SimpleCov is built against various other Rubies, including Rubinius and JRuby,
591
+ in [Continuous Integration], but this happens only to ensure that SimpleCov
592
+ does not make your test suite crash right now. Whether SimpleCov will support
593
+ JRuby/Rubinius in the future depends solely on whether those Ruby interpreters
594
+ add the coverage library.
601
595
 
602
- #### [simplecov-cobertura](https://github.com/dashingrocket/simplecov-cobertura)
603
- *by Jesse Bowes*
596
+ SimpleCov is built in [Continuous Integration] on Ruby 1.9.3, 2.0.0, 2.1, and 2.2.
604
597
 
605
- A formatter that generates Cobertura XML.
598
+ ## Want to find dead code in production?
606
599
 
607
- ## Ruby version compatibility
600
+ Try [Coverband](https://github.com/danmayer/coverband).
608
601
 
609
- [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)](http://travis-ci.org/colszowka/simplecov)
602
+ ## Want to use Spring with SimpleCov?
610
603
 
611
- Only Ruby 1.9+ ships with the coverage library that SimpleCov depends upon. SimpleCov is built against various other Rubies,
612
- including Rubinius and JRuby, in [Continuous Integration], but this happens only to ensure that SimpleCov does not make your
613
- test suite crash right now. Whether SimpleCov will support JRuby/Rubinius in the future depends solely on whether those Ruby
614
- interpreters add the coverage library.
604
+ 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!
615
605
 
616
- SimpleCov is built in [Continuous Integration] on Ruby 1.9.3, 2.0.0, 2.1, and 2.2.
606
+ 1. Change the following settings in `development.rb` and `test.rb`.
617
607
 
618
- ## Want to find dead code in production?
608
+ ```ruby
609
+ # Disable Rails's static asset server (Apache or nginx will already do this)
610
+ config.serve_static_files = false
611
+ config.eager_load = false
612
+ ```
613
+ 2. Add your SimpleCov config, as you normally would, to your `spec_helper.rb`
614
+ (or `rails_helper.rb` for RSpec 3). If you have a `config/spring.rb` file
615
+ (or anything similar), add it to the start of such file. Here's a simple
616
+ version of what the config should look like:
619
617
 
620
- Try [coverband](https://github.com/danmayer/coverband).
618
+ ```ruby
619
+ if ENV['RAILS_ENV'] == 'test'
620
+ require 'simplecov'
621
+ SimpleCov.start
622
+ end
623
+ ```
624
+ 3. Run `spring rspec <path>` as normal. Remember to run `spring stop` after
625
+ making important changes to your app or its specs!
621
626
 
622
627
  ## Contributing
623
628
 
@@ -629,4 +634,4 @@ Thanks to Aaron Patterson for the original idea for this!
629
634
 
630
635
  ## Copyright
631
636
 
632
- Copyright (c) 2010-2013 Christoph Olszowka. See MIT-LICENSE for details.
637
+ Copyright (c) 2010-2015 Christoph Olszowka. See MIT-LICENSE for details.