coco 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTORS +9 -0
- data/Changelog.markdown +42 -0
- data/Gemfile.lock +36 -55
- data/LICENSE +7 -0
- data/README.markdown +124 -73
- data/Rakefile +10 -37
- data/VERSION +1 -1
- data/lib/coco.rb +9 -21
- data/lib/coco/configuration.rb +59 -20
- data/lib/coco/cover.rb +1 -0
- data/lib/coco/cover/coverage_result.rb +72 -16
- data/lib/coco/cover/coverage_stat.rb +20 -8
- data/lib/coco/cover/summary.rb +50 -0
- data/lib/coco/deprecated_message.rb +31 -0
- data/lib/coco/formatter.rb +2 -2
- data/lib/coco/formatter/colored_string.rb +1 -1
- data/lib/coco/formatter/console_formatter.rb +24 -19
- data/lib/coco/formatter/context.rb +10 -39
- data/lib/coco/formatter/html_formatter.rb +7 -13
- data/lib/coco/formatter/html_index_formatter.rb +20 -16
- data/lib/coco/formatter/index_context.rb +37 -0
- data/lib/coco/formatter/index_line.rb +21 -0
- data/lib/coco/formatter/template.rb +2 -3
- data/lib/coco/helpers.rb +88 -68
- data/lib/coco/lister/source_lister.rb +23 -26
- data/lib/coco/lister/uncovered_lister.rb +6 -9
- data/lib/coco/project.rb +65 -0
- data/lib/coco/theme.rb +15 -0
- data/lib/coco/writer/file_writer.rb +5 -5
- data/lib/coco/writer/html_directory.rb +16 -8
- data/lib/coco/writer/html_files_writer.rb +9 -6
- data/lib/coco/writer/html_index_writer.rb +6 -3
- data/template/css/dark.css +178 -0
- data/template/css/{coco.css → light.css} +22 -9
- data/template/file.erb +3 -3
- data/template/index.erb +35 -33
- data/template/js/coco.js +18 -0
- metadata +34 -58
- data/COPYING +0 -674
- data/lib/coco/formatter/formatter.rb +0 -23
- data/template/img/coconut16.png +0 -0
- data/template/img/licenses +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2ad77928953cdcb188c1a23fd0e3305876a3d63
|
4
|
+
data.tar.gz: 6575f5fea0141f3824172835eb1f701485d694cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acb60b91e3097ea477f510a3cb235cc02b120e29399b5228f0f7c519855152fd458757f6242b5dffd95dfdd2479b5d97b21a5f8c3985abaade3398c7aff883ee
|
7
|
+
data.tar.gz: fd645a95bbc252eb7face09d94cf7b0e305eeedda922431a51c9d5597b271b224eb8fef4b77c4e8d9b44634c5c7598510ab9d5b46c1ac1dc4bf0780b6d64e77f
|
data/CONTRIBUTORS
ADDED
data/Changelog.markdown
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
Next version (Unreleased)
|
2
|
+
=================================================
|
3
|
+
|
4
|
+
|
5
|
+
v0.14.0 (2016-04-16)
|
6
|
+
=================================================
|
7
|
+
|
8
|
+
## Added
|
9
|
+
|
10
|
+
* Add a summary (rate of coverage, number of uncovered files and total number of
|
11
|
+
files) in the HTML report and on the console.
|
12
|
+
* You can now view all files in the HTML report, even those equal to or above
|
13
|
+
the threshold. This feature allow you to view the line's hit for every files.
|
14
|
+
* Add support for Ruby 2.3.
|
15
|
+
* Now you can choose between a dark theme and the (old) light one, for the HTML
|
16
|
+
report. The choice is made with a new configuration key : `:theme`. The
|
17
|
+
default theme is the light one.
|
18
|
+
* Add acceptance testing with Cucumber.
|
19
|
+
* [Experimental] Add support for head of MRI Ruby.
|
20
|
+
* [Experimental] Add support for Rubinius 2.x.
|
21
|
+
* [Experimental] Add support for (latest version of) JRuby.
|
22
|
+
* [Experimental] Add support for OSX.
|
23
|
+
|
24
|
+
## Changed
|
25
|
+
|
26
|
+
* The single line report (on the console) is now the default behavior.
|
27
|
+
* The license is now MIT.
|
28
|
+
* Move contributors list in a file.
|
29
|
+
|
30
|
+
## Removed
|
31
|
+
|
32
|
+
* Removed the license's mention in the reports's index.
|
33
|
+
* Removed the gems reek and flay from the development dependencies.
|
34
|
+
|
35
|
+
## Deprecated
|
36
|
+
|
37
|
+
* The configuration key `directories` will be removed in a future version, the
|
38
|
+
new key to use is `include`.
|
39
|
+
* The configuration key `excludes` will be removed in a future version, the
|
40
|
+
new key to use is `exclude`.
|
41
|
+
|
42
|
+
|
1
43
|
v0.13.0 (2015-07-03)
|
2
44
|
=================================================
|
3
45
|
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coco (0.
|
4
|
+
coco (0.14.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
builder (3.2.2)
|
10
|
+
cucumber (2.3.3)
|
11
|
+
builder (>= 2.1.2)
|
12
|
+
cucumber-core (~> 1.4.0)
|
13
|
+
cucumber-wire (~> 0.0.1)
|
14
|
+
diff-lcs (>= 1.1.3)
|
15
|
+
gherkin (~> 3.2.0)
|
16
|
+
multi_json (>= 1.7.5, < 2.0)
|
17
|
+
multi_test (>= 0.1.2)
|
18
|
+
cucumber-core (1.4.0)
|
19
|
+
gherkin (~> 3.2.0)
|
20
|
+
cucumber-wire (0.0.1)
|
17
21
|
diff-lcs (1.2.5)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
sexp_processor (~> 4.0)
|
22
|
-
ice_nine (0.11.1)
|
23
|
-
memoizable (0.4.2)
|
24
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
25
|
-
parser (2.2.2.6)
|
26
|
-
ast (>= 1.1, < 3.0)
|
27
|
-
procto (0.0.2)
|
28
|
-
rainbow (2.0.0)
|
22
|
+
gherkin (3.2.0)
|
23
|
+
multi_json (1.11.2)
|
24
|
+
multi_test (0.1.2)
|
29
25
|
rake (10.4.2)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
rspec (
|
35
|
-
rspec-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
rspec-
|
40
|
-
diff-lcs (>= 1.
|
41
|
-
|
42
|
-
|
43
|
-
sexp_processor (~> 4.1)
|
44
|
-
sexp_processor (4.6.0)
|
45
|
-
thread_safe (0.3.5)
|
46
|
-
tomparse (0.4.2)
|
47
|
-
unparser (0.2.4)
|
48
|
-
abstract_type (~> 0.0.7)
|
49
|
-
adamantium (~> 0.2.0)
|
50
|
-
concord (~> 0.1.5)
|
51
|
-
diff-lcs (~> 1.2.5)
|
52
|
-
equalizer (~> 0.0.9)
|
53
|
-
parser (~> 2.2.2)
|
54
|
-
procto (~> 0.0.2)
|
55
|
-
yard (0.8.7.6)
|
56
|
-
yard-tomdoc (0.7.1)
|
57
|
-
tomparse (>= 0.4.0)
|
58
|
-
yard
|
26
|
+
rspec (3.4.0)
|
27
|
+
rspec-core (~> 3.4.0)
|
28
|
+
rspec-expectations (~> 3.4.0)
|
29
|
+
rspec-mocks (~> 3.4.0)
|
30
|
+
rspec-core (3.4.4)
|
31
|
+
rspec-support (~> 3.4.0)
|
32
|
+
rspec-expectations (3.4.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.4.0)
|
35
|
+
rspec-mocks (3.4.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.4.0)
|
38
|
+
rspec-support (3.4.1)
|
59
39
|
|
60
40
|
PLATFORMS
|
61
41
|
ruby
|
62
42
|
|
63
43
|
DEPENDENCIES
|
64
|
-
bundler (~> 1.
|
44
|
+
bundler (~> 1.11)
|
65
45
|
coco!
|
66
|
-
|
67
|
-
rake
|
68
|
-
|
69
|
-
|
70
|
-
|
46
|
+
cucumber
|
47
|
+
rake
|
48
|
+
rspec (~> 3.4)
|
49
|
+
|
50
|
+
BUNDLED WITH
|
51
|
+
1.11.2
|
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2016 Xavier Nayrac
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -3,27 +3,15 @@ coco [![Build Status](https://travis-ci.org/lkdjiin/coco.png)](https://travis-ci
|
|
3
3
|
|
4
4
|
— *«If it's well-covered it doesn't mean it's well-tested!»* —
|
5
5
|
|
6
|
-
Code coverage tool for ruby 2.0, 2.1 and 2.
|
6
|
+
Code coverage tool for ruby 2.0, 2.1, 2.2 and 2.3.
|
7
7
|
=======
|
8
8
|
|
9
|
-
Features
|
10
|
-
--------------------------------
|
11
|
-
|
12
|
-
* Use it from rspec or test/unit with a simple `require 'coco'`
|
13
|
-
* Works with Rails
|
14
|
-
* Display names of uncovered files on console
|
15
|
-
* _Simple_ html report _only_ for uncovered files
|
16
|
-
* Report sources that have no tests
|
17
|
-
* Configurable via a simple yaml file
|
18
|
-
* Colorized console output (nix only)
|
19
|
-
|
20
|
-
|
21
9
|
Install
|
22
10
|
--------------------------------
|
23
11
|
|
24
12
|
In your Gemfile:
|
25
13
|
|
26
|
-
gem coco
|
14
|
+
gem 'coco'
|
27
15
|
|
28
16
|
Or directly:
|
29
17
|
|
@@ -31,6 +19,10 @@ Or directly:
|
|
31
19
|
|
32
20
|
*NOTE: If you're using a Gemfile, don't `:require => false`*
|
33
21
|
|
22
|
+
And in case you want to test the latest development:
|
23
|
+
|
24
|
+
gem 'coco', github: 'lkdjiin/coco', branch: 'development'
|
25
|
+
|
34
26
|
Usage
|
35
27
|
--------------------------------
|
36
28
|
Require the coco library at the beginning of your tests:
|
@@ -40,87 +32,147 @@ Require the coco library at the beginning of your tests:
|
|
40
32
|
Usually you do this only once, by putting this line in an spec_helper.rb,
|
41
33
|
or test_helper.rb (or whatever you named it).
|
42
34
|
|
43
|
-
###View report
|
35
|
+
### View report
|
44
36
|
|
45
|
-
After your tests, coco will display a short report in the console
|
37
|
+
After your tests, coco will display a **very** short report in the console
|
38
|
+
window, like this one:
|
46
39
|
|
47
40
|
$ rake test
|
48
41
|
[...]
|
49
42
|
26 examples, 0 failures
|
50
|
-
0% /home/xavier/project/lib/iprune.rb
|
51
|
-
0% /home/xavier/project/lib/iprune/iprune.rb
|
52
|
-
46% /home/xavier/project/lib/parser/prunille.rb
|
53
|
-
$
|
54
43
|
|
55
|
-
|
56
|
-
|
57
|
-
a line by line report.
|
44
|
+
Rate 82% | Uncovered 0 | Files 7
|
45
|
+
$
|
58
46
|
|
59
|
-
|
60
|
-
|
47
|
+
coco will also create a `coverage/` folder at the root of the project. Browse
|
48
|
+
the `coverage/index.html` to access a line by line report.
|
61
49
|
|
62
50
|
_Note: files with a coverage of 0% are only listed in index.html ; there
|
63
51
|
is no line by line report for such files._
|
64
52
|
|
65
|
-
Configuration
|
53
|
+
Basic Configuration
|
66
54
|
----------------------------------
|
67
55
|
|
68
56
|
Configuration is done via a YAML file. You can configure:
|
69
57
|
|
58
|
+
* __theme__: Choose between a light and a dark theme for the HTML report
|
70
59
|
* __threshold__: the percentage threshold
|
71
|
-
*
|
72
|
-
*
|
73
|
-
* __single_line_report__: the report
|
60
|
+
* __include__: the directories from where coco will search for untested source files
|
61
|
+
* __exclude__: a list of files and/or directories to exclude from the report, if any
|
62
|
+
* __single_line_report__: style of the report in the console
|
63
|
+
|
64
|
+
By default, threshold is set to 100, the list of directories is set to `['lib']`,
|
65
|
+
no files are excluded and the console report is a single line one.
|
66
|
+
|
67
|
+
To change this default configuration, put a `.coco.yml` file at the root of your project.
|
68
|
+
|
69
|
+
### Theme
|
70
|
+
|
71
|
+
You can choose between a light and a dark theme. The light theme is the
|
72
|
+
default one. For a dark theme, add this line in the configuration file:
|
73
|
+
|
74
|
+
:theme: dark
|
75
|
+
|
76
|
+
**Light theme**
|
77
|
+
|
78
|
+
![light](theme-light.png)
|
79
|
+
|
80
|
+
**Dark theme**
|
81
|
+
|
82
|
+
![dark](theme-dark.png)
|
83
|
+
|
84
|
+
### Threshold
|
85
|
+
|
86
|
+
Add the following line to your .coco.yml file to set the threshold to 80%.
|
87
|
+
|
88
|
+
:threshold: 80
|
89
|
+
|
90
|
+
Only files under 80% of coverage will be directly reported in the report.
|
91
|
+
I strongly advice to use the default threshold (100%).
|
92
|
+
|
93
|
+
### Directories Included
|
74
94
|
|
75
|
-
|
95
|
+
Add the following lines to your .coco.yml file to set the directories to both
|
96
|
+
'lib' and “ext':
|
76
97
|
|
77
|
-
|
98
|
+
:include:
|
99
|
+
- lib
|
100
|
+
- ext
|
101
|
+
|
102
|
+
### Files and Directories Excludes
|
103
|
+
|
104
|
+
Add the following lines to your .coco.yml file to exclude a file from the
|
105
|
+
report:
|
106
|
+
|
107
|
+
:exclude:
|
108
|
+
- lib/project/file1.rb
|
109
|
+
|
110
|
+
Add the following lines to your .coco.yml file to exclude a whole folder's
|
111
|
+
content from the report:
|
112
|
+
|
113
|
+
:exclude:
|
114
|
+
- config/initializers
|
115
|
+
|
116
|
+
Of course you can mix files and folders:
|
117
|
+
|
118
|
+
:exclude:
|
119
|
+
- path/to/file1
|
120
|
+
- path/to/file2
|
121
|
+
- folder1
|
122
|
+
- path/to/folder2
|
123
|
+
|
124
|
+
### Single line report
|
125
|
+
|
126
|
+
By default, the console's reports a brief, one line, summary. If instead, you
|
127
|
+
want to display the coverage of all files under the threeshold, put this line
|
128
|
+
in your .coco.yml file:
|
78
129
|
|
130
|
+
:single_line_report: false
|
79
131
|
|
80
|
-
|
132
|
+
Advice: Don't do this!
|
81
133
|
|
82
|
-
|
134
|
+
## Sample config for a Rails project
|
135
|
+
|
136
|
+
:include:
|
83
137
|
- app
|
138
|
+
- custom_dir
|
84
139
|
- lib
|
85
|
-
:
|
86
|
-
- spec
|
140
|
+
:exclude:
|
87
141
|
- config/initializers
|
88
|
-
:single_line_report: true
|
89
142
|
|
90
143
|
_Note: YAML is very punctilious with the syntax. In particular, paid attention
|
91
144
|
to not put any leading spaces or tab at all._
|
92
145
|
|
93
|
-
See [more examples](https://github.com/lkdjiin/coco/wiki) on the wiki.
|
94
146
|
|
95
147
|
Advanced configuration
|
96
148
|
---------------------------------
|
97
149
|
|
98
150
|
### See coverage of all files in the console
|
99
151
|
|
100
|
-
By default,
|
101
|
-
threshold. And as the threshold is
|
102
|
-
displayed if your test suite is 100% covered.
|
103
|
-
some people, or worst, you could even feel like Coco
|
104
|
-
wrong way.
|
152
|
+
By default, with a multilines report style on the console, Coco will display
|
153
|
+
only the files with a coverage above the threshold. And as the threshold is
|
154
|
+
100% by default, nothing will be displayed if your test suite is 100% covered.
|
155
|
+
This could be annoying for some people, or worst, you could even feel like Coco
|
156
|
+
doing something the wrong way.
|
105
157
|
|
106
|
-
So, to display in green the covered files,
|
107
|
-
|
158
|
+
So, to display in green the covered files, put this in your `.coco.yml`
|
159
|
+
configuration file:
|
108
160
|
|
109
161
|
:exclude_above_threshold: false
|
110
162
|
|
111
163
|
### When to start coco, and when not to start it
|
112
|
-
|
113
|
-
|
114
|
-
But when the test suite takes longer to
|
115
|
-
run a single test more often than the complete
|
116
|
-
the behavior of
|
117
|
-
test and
|
118
|
-
problem here is this is a lie. To avoid this behavior, I recommend to
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
__always_run__: If true,
|
123
|
-
If false,
|
164
|
+
|
165
|
+
For projects whose complete test suite runs in a matter of seconds, running
|
166
|
+
code coverage with every test is fine. But when the test suite takes longer to
|
167
|
+
complete, we typically start to run a single test more often than the complete
|
168
|
+
suite. In such cases, the behavior of Coco could be really annoying: you
|
169
|
+
run a single test and Coco reports a infinite list of uncovered files. The
|
170
|
+
problem here is this is a lie. To avoid this behavior, I recommend to run code
|
171
|
+
coverage only from time to time, and with the entire test suite. To do so,
|
172
|
+
Coco provide the following configuration key:
|
173
|
+
|
174
|
+
__always_run__: If true, Coco will run every time you start a test.
|
175
|
+
If false, Coco will run only when you explicitly set an
|
124
176
|
environement variable named `COCO` with something other than `false`,
|
125
177
|
`0` or the empty string.
|
126
178
|
|
@@ -132,12 +184,12 @@ Put this in your `.coco.yml` configuration file:
|
|
132
184
|
|
133
185
|
Now, when you run:
|
134
186
|
|
135
|
-
rspec
|
187
|
+
rspec
|
136
188
|
|
137
|
-
|
189
|
+
…Coco will no start. To start it, you have to set the
|
138
190
|
environement variable `COCO`, like this:
|
139
191
|
|
140
|
-
COCO=1 rspec
|
192
|
+
COCO=1 rspec
|
141
193
|
|
142
194
|
### Index page URI in your terminal
|
143
195
|
|
@@ -161,10 +213,20 @@ Now, when running tests, you will see something like the following:
|
|
161
213
|
See file:///path/to/your/coverage/index.html
|
162
214
|
|
163
215
|
|
164
|
-
|
216
|
+
How is this different than [SimpleCov](https://github.com/colszowka/simplecov) ?
|
165
217
|
--------------------------------
|
166
218
|
|
167
|
-
|
219
|
+
I designed Coco from the start to have only the features I need. And I don't
|
220
|
+
need much: 95% of the time, all I want is a tiny one line summary in my console.
|
221
|
+
|
222
|
+
It's easier. Add a single line of code at the start of your spec helper and
|
223
|
+
you are good to go.
|
224
|
+
|
225
|
+
It's faster. Because Coco has no dependencies and less features, analyzing and
|
226
|
+
reporting are so fast you don't even notice them.
|
227
|
+
|
228
|
+
To synthesize, if you have big needs, give SimpleCov a try ; if you have small
|
229
|
+
needs, give Coco a try.
|
168
230
|
|
169
231
|
|
170
232
|
Contributing
|
@@ -182,7 +244,7 @@ Contributing
|
|
182
244
|
|
183
245
|
License
|
184
246
|
--------------------------------
|
185
|
-
|
247
|
+
MIT, see LICENSE.
|
186
248
|
|
187
249
|
|
188
250
|
Questions and/or Comments
|
@@ -191,14 +253,3 @@ Questions and/or Comments
|
|
191
253
|
Feel free to email [Xavier Nayrac](mailto:xavier.nayrac@gmail.com)
|
192
254
|
with any questions, or contact me on [twitter](https://twitter.com/lkdjiin).
|
193
255
|
|
194
|
-
Contributors
|
195
|
-
--------------------------------
|
196
|
-
|
197
|
-
[sunaku (Suraj N. Kurapati)](https://github.com/sunaku)
|
198
|
-
|
199
|
-
[Daniel Rice](https://github.com/BigNerdRanchDan)
|
200
|
-
|
201
|
-
[Gioele](https://github.com/gioele)
|
202
|
-
|
203
|
-
[TiteiKo](https://github.com/TiteiKo)
|
204
|
-
|