rspec-ci-prettify 0.1.0 → 0.2.0
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/rspec/ci/prettify/constants.rb +1 -1
- data/lib/rspec/ci/prettify/formatter.rb +36 -29
- data/lib/rspec/ci/prettify/version.rb +1 -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: cf3101b2b7072996c975de110df7bac584d6205895ab9bf552bcf41fa35617b8
|
4
|
+
data.tar.gz: 1845bf2494e6b29d36dee4c2c27141e54e3aa832b979717b4fcff2a5f78dc54d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9614286b2c32940116ddbfb04d60945c334f3ee03deb77b099480ab41814748cdd1b16d023654eee04faf14fb97fb4b0494e04bc86559671a5723515ac4bd84d
|
7
|
+
data.tar.gz: 26fca45f6d8e042fb3907bdb098b977128079d56e2eed9e821588c4f375532b1b3ff0cc50df4bdd71c1630eaa516fdf426371f61eda1ef20af6e0c93e94d23cd
|
@@ -17,37 +17,43 @@ module RSpec
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def dump_summary(summary)
|
20
|
-
@output <<
|
21
|
-
@output <<
|
20
|
+
@output << "\n\n"
|
21
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap(RSpec::Ci::Prettify::Constants::SEPARATOR, :bold_white)
|
22
|
+
@output << "\n\n"
|
23
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap("SUMMARY:", :cyan)
|
22
24
|
|
23
25
|
build_summary(summary)
|
24
26
|
end
|
25
27
|
|
26
28
|
def dump_pending(notification)
|
27
|
-
@output <<
|
28
|
-
@output <<
|
29
|
+
@output << "\n\n"
|
30
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap(RSpec::Ci::Prettify::Constants::SEPARATOR, :bold_white)
|
31
|
+
@output << "\n\n"
|
32
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap("PENDING:", :pending)
|
33
|
+
@output << "\n\n\t"
|
29
34
|
|
30
35
|
@output << notification.pending_examples.map do |example|
|
31
|
-
|
36
|
+
RSpec::Core::Formatters::ConsoleCodes.wrap(format_example_summary(example), :pending)
|
32
37
|
end.join("\n\t")
|
33
38
|
end
|
34
39
|
|
35
40
|
def dump_failures(notification)
|
36
|
-
@output <<
|
37
|
-
@output <<
|
41
|
+
@output << "\n\n"
|
42
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap(RSpec::Ci::Prettify::Constants::SEPARATOR, :bold_white)
|
43
|
+
@output << "\n\n"
|
44
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap("FAILURES:", :failure)
|
45
|
+
@output << "\n\n\t"
|
38
46
|
@output << failed_examples_output(notification)
|
39
47
|
end
|
40
48
|
|
41
49
|
def example_passed(example)
|
42
|
-
|
50
|
+
|
43
51
|
end
|
44
52
|
|
45
53
|
def example_failed(example)
|
46
|
-
# @output << RSpec::Core::Formatters::ConsoleCodes.wrap("F", :failure)
|
47
54
|
end
|
48
55
|
|
49
56
|
def example_pending(example)
|
50
|
-
# @output << RSpec::Core::Formatters::ConsoleCodes.wrap("*", :pending)
|
51
57
|
end
|
52
58
|
|
53
59
|
def close(_notification)
|
@@ -63,44 +69,48 @@ module RSpec
|
|
63
69
|
|
64
70
|
failure_count = summary.failed_examples.count
|
65
71
|
pass_count = total_tests_ran - failure_count
|
66
|
-
|
72
|
+
@output << "\n"
|
67
73
|
@output << build_test_suite_duration(summary, total_tests_ran)
|
74
|
+
@output << "\n"
|
68
75
|
@output << build_pending_summary(pending_count, total_test_count)
|
69
76
|
|
70
77
|
if pass_count == total_tests_ran
|
71
|
-
@output <<
|
78
|
+
@output << "\n"
|
79
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap("All #{total_tests_ran} tests ran passed!!!", :magenta)
|
72
80
|
return
|
73
81
|
end
|
74
|
-
|
82
|
+
@output << "\n"
|
75
83
|
@output << build_failure_summary(failure_count, total_tests_ran)
|
84
|
+
@output << "\n"
|
76
85
|
@output << build_pass_summary(pass_count, total_tests_ran)
|
86
|
+
@output << "\n"
|
77
87
|
end
|
78
88
|
|
79
89
|
def build_test_suite_duration(summary, test_run_count)
|
80
90
|
duration = RSpec::Core::Formatters::Helpers.format_duration(summary.duration)
|
81
|
-
duration_text = "
|
91
|
+
duration_text = "Ran #{test_run_count} tests overall in #{duration}."
|
82
92
|
|
83
|
-
|
93
|
+
RSpec::Core::Formatters::ConsoleCodes.wrap(duration_text, :cyan)
|
84
94
|
end
|
85
95
|
|
86
96
|
def build_pending_summary(pending_count, total_test_count)
|
87
97
|
pending_percentage = percentage_of_examples(pending_count, total_test_count)
|
88
|
-
|
89
|
-
|
98
|
+
|
99
|
+
pending_summary = "#{pending_percentage} of tests skipped/pending (#{pending_count})"
|
100
|
+
indent(RSpec::Core::Formatters::ConsoleCodes.wrap(pending_summary, :pending), 4)
|
90
101
|
end
|
91
102
|
|
92
103
|
def build_failure_summary(failure_count, total_tests_ran)
|
93
104
|
failure_percentage = percentage_of_examples(failure_count, total_tests_ran)
|
94
|
-
failure_summary = "
|
95
|
-
indent(
|
105
|
+
failure_summary = "#{failure_percentage} of tests failed (#{failure_count})"
|
106
|
+
indent(RSpec::Core::Formatters::ConsoleCodes.wrap(failure_summary, :failure), 4)
|
96
107
|
end
|
97
108
|
|
98
109
|
def build_pass_summary(pass_count, total_tests_ran)
|
99
110
|
pass_percentage = percentage_of_examples(pass_count, total_tests_ran)
|
111
|
+
pass_summary = "#{pass_percentage} of tests passed (#{pass_count})"
|
100
112
|
|
101
|
-
pass_summary
|
102
|
-
|
103
|
-
indent(format_colour(pass_summary, :success), 4)
|
113
|
+
indent(RSpec::Core::Formatters::ConsoleCodes.wrap(pass_summary, :success), 4)
|
104
114
|
end
|
105
115
|
|
106
116
|
def percentage_of_examples(count, total)
|
@@ -120,10 +130,6 @@ module RSpec
|
|
120
130
|
output.join("\n\n\t")
|
121
131
|
end
|
122
132
|
|
123
|
-
def format_colour(str, status)
|
124
|
-
RSpec::Core::Formatters::ConsoleCodes.wrap(str, status)
|
125
|
-
end
|
126
|
-
|
127
133
|
def format_example_summary(example)
|
128
134
|
full_description = example.full_description
|
129
135
|
location = example.location
|
@@ -132,10 +138,11 @@ module RSpec
|
|
132
138
|
|
133
139
|
def failed_example_output(example)
|
134
140
|
msg = example.execution_result.exception.message
|
135
|
-
|
136
|
-
|
141
|
+
sanitized_err_message = sanitize_msg(msg)
|
142
|
+
formatted_err_message = RSpec::Core::Formatters::ConsoleCodes.wrap(sanitized_err_message, :failure)
|
143
|
+
summary = RSpec::Core::Formatters::ConsoleCodes.wrap(format_example_summary(example), :failure)
|
137
144
|
|
138
|
-
"#{summary} \n #{formatted_err_message}"
|
145
|
+
"#{summary} \n #{formatted_err_message} \n"
|
139
146
|
end
|
140
147
|
|
141
148
|
def sanitize_msg(msg)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-ci-prettify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jjholmes927
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|