teststats 0.1.0 → 0.1.1
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/lib/teststats/cli.rb +4 -5
- data/lib/teststats/line_chart.html.erb +3 -3
- data/lib/teststats/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 876b1230bf41b41ae993f09846d383902166aa03
|
4
|
+
data.tar.gz: 574c6f0eef881744b6b1a63405b6bd4997c16f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13288f750d7f097a931b752e3c0eb65d15c16ab22e099f5790043c6a1199707bc7e3bf9c2b3dcb8b875fbdd4828d6c5655ef497a9c7e9758ddf7f828861f67ee
|
7
|
+
data.tar.gz: 02e759b5cfaf8b0f1f412bd4625f23e58e439072ed715a7d5bc2904545f645888fd5f5d7d700a8f11e0235ad47cd3ceff3918c07072c1779d50795b29768ee4c
|
data/lib/teststats/cli.rb
CHANGED
@@ -8,13 +8,11 @@ module Teststats
|
|
8
8
|
DEFAULTS = {
|
9
9
|
'test_unit' => {
|
10
10
|
:pattern => '*_test.rb',
|
11
|
-
:directory => 'test'
|
12
|
-
:test_regex => /^\s+def test_/
|
11
|
+
:directory => 'test'
|
13
12
|
},
|
14
13
|
'rspec' => {
|
15
14
|
:pattern => '*_spec.rb',
|
16
|
-
:directory => 'spec'
|
17
|
-
:test_regex => /^\s+it ["']/
|
15
|
+
:directory => 'spec'
|
18
16
|
}
|
19
17
|
}
|
20
18
|
desc "count", "Test count growing stats. Notice, this command will checkout old revisions to count tests, recommend a clean repository to avoid problem."
|
@@ -57,12 +55,13 @@ module Teststats
|
|
57
55
|
puts "Unsupported framework #{name.inspect}, options: #{DEFAULTS.keys.inspect}"
|
58
56
|
exit(1)
|
59
57
|
end
|
58
|
+
test_regex = /^\s+(def\s+test_|test\s+['"]|it\s+['"])/
|
60
59
|
f = {:name => name}
|
61
60
|
DEFAULTS[name].each do |k, v|
|
62
61
|
f[k] = options[k] || v
|
63
62
|
end
|
64
63
|
f[:test_files] = [f[:directory], '**', f[:pattern]].join("/")
|
65
|
-
f[:count] = lambda {|file| File.read(file).split("\n").map {|l| l =~
|
64
|
+
f[:count] = lambda {|file| File.read(file).split("\n").map {|l| l =~ test_regex ? 1 : 0}.reduce(:+).to_i}
|
66
65
|
OpenStruct.new(f)
|
67
66
|
end
|
68
67
|
|
@@ -32,9 +32,9 @@ body {
|
|
32
32
|
<script>
|
33
33
|
var yAxisLabel = 'Test Count';
|
34
34
|
var data = <%= data.to_json %>;
|
35
|
-
var margin = {top: 20, right: 50, bottom:
|
36
|
-
width = window.innerWidth - margin.left - margin.right,
|
37
|
-
height =
|
35
|
+
var margin = {top: 20, right: 50, bottom: 150, left: 50},
|
36
|
+
width = window.innerWidth - 20 - margin.left - margin.right,
|
37
|
+
height = window.innerHeight - 20 - margin.top - margin.bottom;
|
38
38
|
|
39
39
|
var parseDate = d3.time.format("%Y-%m-%d").parse;
|
40
40
|
|
data/lib/teststats/version.rb
CHANGED