dotpretty 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dotpretty/aggregator.rb +8 -0
- data/lib/dotpretty/colorers/bash.rb +5 -0
- data/lib/dotpretty/colorers/null.rb +4 -0
- data/lib/dotpretty/parser.rb +1 -0
- data/lib/dotpretty/reporters/basic.rb +12 -7
- data/lib/dotpretty/reporters/json.rb +7 -0
- data/lib/dotpretty/reporters/progress.rb +23 -7
- data/lib/dotpretty/reporters/test_summary_formatter.rb +27 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8205f1decc125ec0d793587399cc4ff3f7969a7eef4af49f329417bb7242e857
|
4
|
+
data.tar.gz: 87de6c2d74f51077c24148848494b89409dfc468423bb9689f043370110cf6e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f4f1bdadaf2d027fcb3390e65e9f4dd2b40f403efe9c345b6448090c0fe5e33ddaef5a87e2a87075a17e7e33cc1e959e742d90cc5bbfdb77674e3bdf3fbe22d
|
7
|
+
data.tar.gz: 31208e1b8de1e11b30c7c3281f2e9677a2c8021fd593c6e85f8f620cdacf217a82e118123ca2f5d5b93e332dd00777c56c081f596e4bb63a3e8faa59e826109f
|
data/lib/dotpretty/aggregator.rb
CHANGED
@@ -5,6 +5,7 @@ module Dotpretty
|
|
5
5
|
BUILD_FAILED = /^Build FAILED.$/
|
6
6
|
TEST_FAILED = /^Failed/
|
7
7
|
TEST_PASSED = /^Passed/
|
8
|
+
TEST_SKIPPED = /^Skipped/
|
8
9
|
TEST_SUMMARY = /^Total tests/
|
9
10
|
TESTS_STARTED = /^Starting test execution, please wait...$/
|
10
11
|
|
@@ -58,6 +59,9 @@ module Dotpretty
|
|
58
59
|
elsif input_line.match(TEST_FAILED)
|
59
60
|
match = input_line.match(/^Failed\s+(.+)$/)
|
60
61
|
state_machine.trigger(:test_failed, match[1])
|
62
|
+
elsif input_line.match(TEST_SKIPPED)
|
63
|
+
match = input_line.match(/^Skipped\s+(.+)$/)
|
64
|
+
state_machine.trigger(:test_skipped, match[1])
|
61
65
|
elsif input_line.match(TEST_SUMMARY)
|
62
66
|
state_machine.trigger(:tests_completed, input_line)
|
63
67
|
else
|
@@ -130,6 +134,10 @@ module Dotpretty
|
|
130
134
|
reporter.test_passed(test_name)
|
131
135
|
end
|
132
136
|
|
137
|
+
def test_skipped(test_name)
|
138
|
+
reporter.test_skipped(test_name)
|
139
|
+
end
|
140
|
+
|
133
141
|
private
|
134
142
|
|
135
143
|
attr_accessor :build_failure_details, :current_failing_test, :reporter
|
@@ -5,6 +5,7 @@ module Dotpretty
|
|
5
5
|
RESET="\e[0m"
|
6
6
|
START_GREEN="\033[32m"
|
7
7
|
START_RED="\033[31m"
|
8
|
+
START_YELLOW="\033[33m"
|
8
9
|
|
9
10
|
def green(text)
|
10
11
|
return "#{START_GREEN}#{text}#{RESET}"
|
@@ -14,6 +15,10 @@ module Dotpretty
|
|
14
15
|
return "#{START_RED}#{text}#{RESET}"
|
15
16
|
end
|
16
17
|
|
18
|
+
def yellow(text)
|
19
|
+
return "#{START_YELLOW}#{text}#{RESET}"
|
20
|
+
end
|
21
|
+
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
data/lib/dotpretty/parser.rb
CHANGED
@@ -40,6 +40,7 @@ module Dotpretty
|
|
40
40
|
transition :received_other_input, :waiting_for_test_input
|
41
41
|
transition :test_failed, :waiting_for_failure_details, :reset_current_failing_test
|
42
42
|
transition :test_passed, :waiting_for_test_input, :test_passed
|
43
|
+
transition :test_skipped, :waiting_for_test_input, :test_skipped
|
43
44
|
transition :tests_completed, :done, :show_test_summary
|
44
45
|
end
|
45
46
|
state :waiting_for_failure_details do
|
@@ -1,8 +1,11 @@
|
|
1
|
+
require "dotpretty/reporters/test_summary_formatter"
|
2
|
+
|
1
3
|
module Dotpretty
|
2
4
|
module Reporters
|
3
5
|
class Basic
|
4
6
|
|
5
7
|
def initialize(colorer:, output:)
|
8
|
+
self.colorer = colorer
|
6
9
|
self.extend(colorer)
|
7
10
|
self.output = output
|
8
11
|
end
|
@@ -31,6 +34,10 @@ module Dotpretty
|
|
31
34
|
output.puts("#{green("Passed")} #{test_name}")
|
32
35
|
end
|
33
36
|
|
37
|
+
def test_skipped(test_name)
|
38
|
+
output.puts("#{yellow("Skipped")} #{test_name}")
|
39
|
+
end
|
40
|
+
|
34
41
|
def test_failed(failing_test)
|
35
42
|
output.puts("#{red("Failed")} #{failing_test[:name]}")
|
36
43
|
failing_test[:details].each do |line|
|
@@ -47,15 +54,13 @@ module Dotpretty
|
|
47
54
|
private
|
48
55
|
|
49
56
|
def colored_message(summary)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
return red(message)
|
55
|
-
end
|
57
|
+
return Dotpretty::Reporters::TestSummaryFormatter.new({
|
58
|
+
colorer: colorer,
|
59
|
+
summary: summary
|
60
|
+
}).colored_message
|
56
61
|
end
|
57
62
|
|
58
|
-
attr_accessor :output
|
63
|
+
attr_accessor :colorer, :output
|
59
64
|
|
60
65
|
end
|
61
66
|
end
|
@@ -3,8 +3,10 @@ module Dotpretty
|
|
3
3
|
class Progress
|
4
4
|
|
5
5
|
def initialize(colorer:, output:)
|
6
|
+
self.colorer = colorer
|
6
7
|
self.extend(colorer)
|
7
8
|
self.failing_tests = []
|
9
|
+
self.skipped_test_names = []
|
8
10
|
self.output = output
|
9
11
|
end
|
10
12
|
|
@@ -27,6 +29,7 @@ module Dotpretty
|
|
27
29
|
def show_test_summary(summary)
|
28
30
|
output.puts("")
|
29
31
|
output.puts("")
|
32
|
+
show_skipped_summary if !skipped_test_names.empty?
|
30
33
|
show_failure_summary if !failing_tests.empty?
|
31
34
|
output.puts(formatted_test_summary(summary))
|
32
35
|
end
|
@@ -44,15 +47,18 @@ module Dotpretty
|
|
44
47
|
output.print(green("."))
|
45
48
|
end
|
46
49
|
|
50
|
+
def test_skipped(test_name)
|
51
|
+
skipped_test_names << test_name
|
52
|
+
output.print(yellow("*"))
|
53
|
+
end
|
54
|
+
|
47
55
|
private
|
48
56
|
|
49
57
|
def formatted_test_summary(summary)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
return red(message)
|
55
|
-
end
|
58
|
+
return Dotpretty::Reporters::TestSummaryFormatter.new({
|
59
|
+
colorer: colorer,
|
60
|
+
summary: summary
|
61
|
+
}).colored_message
|
56
62
|
end
|
57
63
|
|
58
64
|
def show_failure_summary
|
@@ -68,7 +74,17 @@ module Dotpretty
|
|
68
74
|
end
|
69
75
|
output.puts("")
|
70
76
|
end
|
71
|
-
|
77
|
+
|
78
|
+
def show_skipped_summary
|
79
|
+
output.puts("Skipped:")
|
80
|
+
output.puts("")
|
81
|
+
skipped_test_names.each_with_index do |test_name, index|
|
82
|
+
output.puts(yellow(" #{index + 1}) #{test_name}"))
|
83
|
+
end
|
84
|
+
output.puts("")
|
85
|
+
end
|
86
|
+
|
87
|
+
attr_accessor :colorer, :failing_tests, :output, :skipped_test_names
|
72
88
|
|
73
89
|
end
|
74
90
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Dotpretty
|
2
|
+
module Reporters
|
3
|
+
class TestSummaryFormatter
|
4
|
+
|
5
|
+
def initialize(colorer:, summary:)
|
6
|
+
self.extend(colorer)
|
7
|
+
self.summary = summary
|
8
|
+
end
|
9
|
+
|
10
|
+
def colored_message
|
11
|
+
message = "Total tests: #{summary[:totalTests]}. Passed: #{summary[:passedTests]}. Failed: #{summary[:failedTests]}. Skipped: #{summary[:skippedTests]}."
|
12
|
+
if summary[:passedTests] == summary[:totalTests]
|
13
|
+
return green(message)
|
14
|
+
elsif summary[:failedTests] > 0
|
15
|
+
return red(message)
|
16
|
+
else
|
17
|
+
return yellow(message)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_accessor :summary
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotpretty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Meyer
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- lib/dotpretty/reporters/json.rb
|
29
29
|
- lib/dotpretty/reporters/names.rb
|
30
30
|
- lib/dotpretty/reporters/progress.rb
|
31
|
+
- lib/dotpretty/reporters/test_summary_formatter.rb
|
31
32
|
- lib/dotpretty/runner.rb
|
32
33
|
- lib/dotpretty/state_details.rb
|
33
34
|
- lib/dotpretty/state_machine.rb
|