simplecov-console 0.9.3 → 0.9.5
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +16 -35
- data/VERSION +1 -1
- data/lib/simplecov-console/output/block.rb +1 -1
- data/lib/simplecov-console/output/table.rb +1 -1
- data/lib/simplecov-console.rb +22 -6
- data/simplecov-console.gemspec +3 -3
- data/test/test_simplecov-console.rb +61 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84f74674ee795a92b2426780fa64273877eab8a17893b015d0c6af9bc69ba5aa
|
|
4
|
+
data.tar.gz: 301d1b39df2e27ac0d1dccce570a0105a2b17b090bef0f6c005ea40df6bcc3f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18eb0f83ee43f731f952d17951a49a4e9027936f605dfcfefb913788f4118dd61a807e74f604bdeafef4e42865d6e30ad452bbd4f6de9c511daacbb0eb52bedd
|
|
7
|
+
data.tar.gz: 64e8281b7cec60f7612dd9047a2d520e842ea24c989142e2b13591c82a5995607f949bc628bb903e933025ab2b5b71ce462764ddd601e917b44b3246403a97ff
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.5 (2026.02.02)
|
|
4
|
+
|
|
5
|
+
- Feat: added `branch_missing_len` option - thanks [@nialbima](https://github.com/nialbima)! ([#28](https://github.com/chetan/simplecov-console/pull/28))
|
|
6
|
+
|
|
7
|
+
## 0.9.4 (2025.07.23)
|
|
8
|
+
|
|
9
|
+
- Docs: updated `use_color` info - thanks [@th7](https://github.com/th7)! ([#27](https://github.com/chetan/simplecov-console/pull/27))
|
|
10
|
+
|
|
11
|
+
## 0.9.3 (2025.02.18)
|
|
12
|
+
|
|
13
|
+
- Added `output_to_file` and `output_filename` options - thanks [@miegs3](https://github.com/miegs3)! ([#26](https://github.com/chetan/simplecov-console/pull/26))
|
|
14
|
+
|
|
3
15
|
## 0.9.2 (2024.09.17)
|
|
4
16
|
|
|
5
17
|
- Fix: typo in output ([#24](https://github.com/chetan/simplecov-console/pull/24))
|
data/README.md
CHANGED
|
@@ -53,11 +53,13 @@ code, generally in your test helper or setup file.
|
|
|
53
53
|
### Options
|
|
54
54
|
|
|
55
55
|
```ruby
|
|
56
|
+
SimpleCov::Formatter::Console.use_colors = false # true (default) or false
|
|
56
57
|
SimpleCov::Formatter::Console.sort = 'path' # sort by file path
|
|
57
58
|
SimpleCov::Formatter::Console.show_covered = true # show all files in coverage report
|
|
58
59
|
SimpleCov::Formatter::Console.max_rows = 15 # integer
|
|
59
60
|
SimpleCov::Formatter::Console.max_lines = 5 # integer
|
|
60
61
|
SimpleCov::Formatter::Console.missing_len = 20 # integer
|
|
62
|
+
SimpleCov::Formatter::Console.branch_missing_len = 0 # integer
|
|
61
63
|
SimpleCov::Formatter::Console.output_style = 'block' # 'table' (default) or 'block'
|
|
62
64
|
SimpleCov::Formatter::Console.table_options = {:style => {:width => 200}}
|
|
63
65
|
SimpleCov::Formatter::Console.output_to_file = false
|
|
@@ -69,7 +71,13 @@ the uppercase name, e.g., `MAX_ROWS`.
|
|
|
69
71
|
|
|
70
72
|
#### Disabling colorized output
|
|
71
73
|
|
|
72
|
-
Color support is active by default. To disable
|
|
74
|
+
Color support is active by default. To disable:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
SimpleCov::Formatter::Console.use_colors = false
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or export `NO_COLOR=1`:
|
|
73
81
|
|
|
74
82
|
```sh
|
|
75
83
|
NO_COLOR=1 rake test
|
|
@@ -198,44 +206,17 @@ BRANCH COVERAGE: 83.33% -- 5/6 branches in 2 branches
|
|
|
198
206
|
+----------+-------------------------------+-------+--------+---------------+-----------------+----------+-----------------+------------------+
|
|
199
207
|
```
|
|
200
208
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
### 0.9.2 (2024.09.17)
|
|
204
|
-
|
|
205
|
-
- Fix: typo in output ([#24](https://github.com/chetan/simplecov-console/pull/24))
|
|
206
|
-
|
|
207
|
-
### 0.9.1 (2021.02.01)
|
|
208
|
-
|
|
209
|
-
- Fix: Don't add ellipsis if line groups are not truncated - thanks [@lbraun](https://github.com/lbraun)! ([#21](https://github.com/chetan/simplecov-console/pull/21))
|
|
210
|
-
|
|
211
|
-
### 0.9 (2021.01.21)
|
|
212
|
-
|
|
213
|
-
- Added support for limiting number of lines shown
|
|
209
|
+
#### Maximum length of missing branches
|
|
214
210
|
|
|
215
|
-
|
|
211
|
+
Similar to `missing_len` above, set `branch_missing_len` to truncate long lists of missing branches.
|
|
216
212
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
- Fix: table output include ([#17](https://github.com/chetan/simplecov-console/issues/17))
|
|
222
|
-
|
|
223
|
-
### 0.7.1 (2020.03.05)
|
|
224
|
-
|
|
225
|
-
- Fix: block output doesn't work with frozen string literal ([#16](https://github.com/chetan/simplecov-console/issues/16))
|
|
226
|
-
|
|
227
|
-
### 0.7 (2020.03.04)
|
|
228
|
-
|
|
229
|
-
- Added new 'block' style output option - thanks [@hpainter](https://github.com/hpainter)! ([#15](https://github.com/chetan/simplecov-console/issues/15))
|
|
230
|
-
|
|
231
|
-
### 0.6 (2019.11.08)
|
|
232
|
-
|
|
233
|
-
- Added new config options: `sort`, `show_covered`, and `max_rows`
|
|
213
|
+
```ruby
|
|
214
|
+
SimpleCov::Formatter::Console.branch_missing_len = 10 # integer (default is 0, no limit)
|
|
215
|
+
```
|
|
234
216
|
|
|
235
|
-
|
|
217
|
+
## History
|
|
236
218
|
|
|
237
|
-
|
|
238
|
-
- Support [disabling colorized](https://no-color.org/) output via `NO_COLOR` env var
|
|
219
|
+
See [Changelog](./CHANGELOG.md)
|
|
239
220
|
|
|
240
221
|
## Contributing
|
|
241
222
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.5
|
|
@@ -16,7 +16,7 @@ class SimpleCov::Formatter::Console
|
|
|
16
16
|
block << sprintf("%8.8s: %s (%d/%d branches)", 'branches',
|
|
17
17
|
colorize(sprintf("%.2f%%", f.coverage_statistics[:branch].percent)),
|
|
18
18
|
(f.total_branches.count - f.missed_branches.count), f.total_branches.count)
|
|
19
|
-
block << sprintf("%8.8s: %s", 'missed', branches_missed(f.missed_branches).join(", "))
|
|
19
|
+
block << sprintf("%8.8s: %s", 'missed', trunc(branches_missed(f.missed_branches).join(", "), type: :branch))
|
|
20
20
|
end
|
|
21
21
|
blocks << block.join("\n")
|
|
22
22
|
end
|
|
@@ -18,7 +18,7 @@ class SimpleCov::Formatter::Console
|
|
|
18
18
|
colorize(pct(f.coverage_statistics[:branch].percent)),
|
|
19
19
|
f.total_branches.count,
|
|
20
20
|
f.missed_branches.count,
|
|
21
|
-
branches_missed(f.missed_branches).join(", ")
|
|
21
|
+
trunc(branches_missed(f.missed_branches).join(", "), type: :branch)
|
|
22
22
|
]
|
|
23
23
|
end
|
|
24
24
|
|
data/lib/simplecov-console.rb
CHANGED
|
@@ -4,8 +4,19 @@ class SimpleCov::Formatter::Console
|
|
|
4
4
|
|
|
5
5
|
VERSION = IO.read(File.expand_path("../../VERSION", __FILE__)).strip
|
|
6
6
|
|
|
7
|
-
ATTRIBUTES = [
|
|
8
|
-
:
|
|
7
|
+
ATTRIBUTES = [
|
|
8
|
+
:branch_missing_len,
|
|
9
|
+
:max_lines,
|
|
10
|
+
:max_rows,
|
|
11
|
+
:missing_len,
|
|
12
|
+
:output_filename,
|
|
13
|
+
:output_style,
|
|
14
|
+
:output_to_file,
|
|
15
|
+
:show_covered,
|
|
16
|
+
:sort,
|
|
17
|
+
:table_options,
|
|
18
|
+
:use_colors,
|
|
19
|
+
]
|
|
9
20
|
|
|
10
21
|
class << self
|
|
11
22
|
attr_accessor(*ATTRIBUTES)
|
|
@@ -21,6 +32,7 @@ class SimpleCov::Formatter::Console
|
|
|
21
32
|
# configure max lines per row and missing len
|
|
22
33
|
SimpleCov::Formatter::Console.max_lines = ENV.fetch('MAX_LINES', 0).to_i
|
|
23
34
|
SimpleCov::Formatter::Console.missing_len = ENV.fetch('MISSING_LEN', 0).to_i
|
|
35
|
+
SimpleCov::Formatter::Console.branch_missing_len = ENV.fetch('BRANCH_MISSING_LEN', 0).to_i
|
|
24
36
|
|
|
25
37
|
# configure show_covered from SHOW_COVERED env var
|
|
26
38
|
SimpleCov::Formatter::Console.show_covered = ENV.fetch('SHOW_COVERED', 'false') == 'true'
|
|
@@ -183,12 +195,16 @@ class SimpleCov::Formatter::Console
|
|
|
183
195
|
end
|
|
184
196
|
|
|
185
197
|
# Truncate string to at most N chars (as defined by missing_len)
|
|
186
|
-
def trunc(str)
|
|
198
|
+
def trunc(str, type: :line)
|
|
187
199
|
return str if str.include?("...") # already truncated, skip
|
|
188
200
|
|
|
189
|
-
len = SimpleCov::Formatter::Console.missing_len
|
|
190
|
-
if len > 0 && str.size > len
|
|
191
|
-
|
|
201
|
+
len = type == :branch ? SimpleCov::Formatter::Console.branch_missing_len : SimpleCov::Formatter::Console.missing_len
|
|
202
|
+
if len > 0 && str.size > len
|
|
203
|
+
truncated = str[0, len]
|
|
204
|
+
if type == :branch && !truncated.end_with?(']')
|
|
205
|
+
truncated = truncated.sub(/,?\s*\d+(\[[^\]]*)?$/, '') # removes partial branch symbols (3[then, 3[t, 3, etc.)
|
|
206
|
+
end
|
|
207
|
+
str = truncated.gsub(/,(\s+)?$/, '') + ' ...'
|
|
192
208
|
end
|
|
193
209
|
str
|
|
194
210
|
end
|
data/simplecov-console.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: simplecov-console 0.9.
|
|
5
|
+
# stub: simplecov-console 0.9.5 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "simplecov-console".freeze
|
|
9
|
-
s.version = "0.9.
|
|
9
|
+
s.version = "0.9.5"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
|
13
13
|
s.authors = ["Chetan Sarva".freeze]
|
|
14
|
-
s.date = "
|
|
14
|
+
s.date = "2026-02-02"
|
|
15
15
|
s.description = "Simple console output formatter for SimpleCov".freeze
|
|
16
16
|
s.email = "chetan@pixelcop.net".freeze
|
|
17
17
|
s.extra_rdoc_files = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'helper'
|
|
2
2
|
|
|
3
|
-
class TestSimplecovConsole <
|
|
3
|
+
class TestSimplecovConsole < Minitest::Test
|
|
4
4
|
|
|
5
5
|
# mock for SimpleCov::SourceFile::Line
|
|
6
6
|
Line = Struct.new(:line_number)
|
|
@@ -41,6 +41,9 @@ class TestSimplecovConsole < MiniTest::Test
|
|
|
41
41
|
def teardown
|
|
42
42
|
SimpleCov::Formatter::Console.output_style = 'table'
|
|
43
43
|
SimpleCov::Formatter::Console.max_lines = 0
|
|
44
|
+
SimpleCov::Formatter::Console.missing_len = 0
|
|
45
|
+
SimpleCov::Formatter::Console.branch_missing_len = 0
|
|
46
|
+
SimpleCov::Formatter::Console.use_colors = true
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def test_defined
|
|
@@ -119,4 +122,61 @@ class TestSimplecovConsole < MiniTest::Test
|
|
|
119
122
|
expected = "\n file: foo.rb\ncoverage: 40.00% (2/5 lines)\n missed: 1, 4-5\nbranches: 50.00% (1/2 branches)\n missed: 2[then]\n\n"
|
|
120
123
|
assert_equal expected, @console.output(files,'/',true)
|
|
121
124
|
end
|
|
125
|
+
|
|
126
|
+
def test_trunc_with_line_type
|
|
127
|
+
SimpleCov::Formatter::Console.missing_len = 10
|
|
128
|
+
|
|
129
|
+
assert_equal "1, 2, 3, 4 ...", @console.trunc("1, 2, 3, 4, 5", type: :line)
|
|
130
|
+
assert_equal "short", @console.trunc("short", type: :line)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def test_trunc_with_branch_type
|
|
134
|
+
SimpleCov::Formatter::Console.branch_missing_len = 16
|
|
135
|
+
|
|
136
|
+
assert_equal "1[then], 2[else]", @console.trunc("1[then], 2[else]", type: :branch)
|
|
137
|
+
assert_equal "1[then], 2[else] ...", @console.trunc("1[then], 2[else], 3[then]", type: :branch)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_trunc_branch_independent_of_missing_len
|
|
141
|
+
SimpleCov::Formatter::Console.missing_len = 5
|
|
142
|
+
SimpleCov::Formatter::Console.branch_missing_len = 20
|
|
143
|
+
|
|
144
|
+
assert_equal "1[then], 2[else]", @console.trunc("1[then], 2[else]", type: :branch)
|
|
145
|
+
assert_equal "1, 2 ...", @console.trunc("1, 2, 3, 4", type: :line)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def test_block_output_with_truncated_branches
|
|
149
|
+
SimpleCov::Formatter::Console.use_colors = false
|
|
150
|
+
SimpleCov::Formatter::Console.output_style = 'block'
|
|
151
|
+
SimpleCov::Formatter::Console.branch_missing_len = 10
|
|
152
|
+
@console.include_output_style
|
|
153
|
+
|
|
154
|
+
files = [
|
|
155
|
+
SourceFileWithBranches.new(
|
|
156
|
+
'foo.rb', 5, [2, 3], [Line.new(1)], 40.0,
|
|
157
|
+
{branch: CoverageStatistics.new(25.0)}, [1, 2, 3, 4],
|
|
158
|
+
[Branch.new(2, :then), Branch.new(3, :else), Branch.new(4, :then)]
|
|
159
|
+
)
|
|
160
|
+
]
|
|
161
|
+
actual = @console.output(files, '/', true)
|
|
162
|
+
|
|
163
|
+
assert_includes actual, "2[then] ..."
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def test_table_output_with_truncated_branches
|
|
167
|
+
SimpleCov::Formatter::Console.output_style = 'table'
|
|
168
|
+
SimpleCov::Formatter::Console.branch_missing_len = 10
|
|
169
|
+
@console.include_output_style
|
|
170
|
+
|
|
171
|
+
files = [
|
|
172
|
+
SourceFileWithBranches.new(
|
|
173
|
+
'foo.rb', 5, [2, 3], [Line.new(1)], 40.0,
|
|
174
|
+
{branch: CoverageStatistics.new(25.0)}, [1, 2, 3, 4],
|
|
175
|
+
[Branch.new(2, :then), Branch.new(3, :else), Branch.new(4, :then)]
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
actual = @console.output(files, '/', true)
|
|
179
|
+
|
|
180
|
+
assert_includes actual.to_s, "2[then] ..."
|
|
181
|
+
end
|
|
122
182
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simplecov-console
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chetan Sarva
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: simplecov
|