rspec_junit_formatter 0.4.0.pre → 0.4.0.pre2
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +10 -7
- data/lib/rspec_junit_formatter.rb +16 -0
- data/lib/rspec_junit_formatter/rspec2.rb +3 -2
- data/lib/rspec_junit_formatter/rspec3.rb +28 -31
- metadata +44 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e45b452b3b1ddc9a5fe134c0f440b5c75f61ede
|
4
|
+
data.tar.gz: cb0b99afd6014613c513c98e52cdf7b7244e07a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f49ef97111a63bb72f5b4b55eba04f1afa1e17e6f1a57a1d0f492b3030db8d810f3ba1dded5bfbae9b27f77284282148c51c763c974352f9abcb42bbde82284f
|
7
|
+
data.tar.gz: 5a3421440dec87320bd86e230a31e18fdd395ab41d6c105296b3cef80101f49c3bc2696e77762184a0d030e8634e2182922b1889449c55b9b3a6ca78c6c17649
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -60,16 +60,19 @@ The formatter includes `$TEST_ENV_NUMBER` in the test suite name within the XML,
|
|
60
60
|
|
61
61
|
## Caveats
|
62
62
|
|
63
|
-
* XML can only represent a [limited subset of characters][xml-charsets] which
|
64
|
-
excludes null bytes and most control characters. This gem will use character
|
65
|
-
entities where possible and fall back to replacing invalid characters with
|
66
|
-
Ruby-like escape codes otherwise. For example, the null byte becomes `\0`.
|
63
|
+
* XML can only represent a [limited subset of characters][xml-charsets] which excludes null bytes and most control characters. This gem will use character entities where possible and fall back to replacing invalid characters with Ruby-like escape codes otherwise. For example, the null byte becomes `\0`.
|
67
64
|
|
68
65
|
## Roadmap
|
69
66
|
|
70
|
-
* It would be nice to split things up into individual test suites, although
|
71
|
-
|
72
|
-
|
67
|
+
* It would be nice to split things up into individual test suites, although would this correspond to example groups? The subject? The spec file? Not sure yet.
|
68
|
+
|
69
|
+
## Development
|
70
|
+
|
71
|
+
Run the specs with `bundle exec rake spec`. Run the specs against a matrix of rspec versions using `bundle exec rake spec:all`.
|
72
|
+
|
73
|
+
## Releasing
|
74
|
+
|
75
|
+
Bump the gem version in the gemspec, and commit. Then `bundle exec rake build` to build a gem package, `bundle exec rake install` to install and test it locally, then `bundle exec rake release` to tag and push the commits and gem.
|
73
76
|
|
74
77
|
## License
|
75
78
|
|
@@ -149,6 +149,22 @@ private
|
|
149
149
|
# Make sure it's utf-8, replace illegal characters with ruby-like escapes, and replace special and discouraged characters with entities
|
150
150
|
text.to_s.encode(Encoding::UTF_8).gsub(ILLEGAL_REGEXP, ILLEGAL_REPLACEMENT).gsub(DISCOURAGED_REGEXP, DISCOURAGED_REPLACEMENTS)
|
151
151
|
end
|
152
|
+
|
153
|
+
STRIP_DIFF_COLORS_BLOCK_REGEXP = /^ ( [ ]* ) Diff: (?: \e\[0m )? (?: \n \1 \e\[\d+m .* )* /x
|
154
|
+
STRIP_DIFF_COLORS_CODES_REGEXP = /\e\[\d+m/
|
155
|
+
|
156
|
+
def strip_diff_colors(string)
|
157
|
+
# XXX: RSpec diffs are appended to the message lines fairly early and will
|
158
|
+
# contain ANSI escape codes for colorizing terminal output if the global
|
159
|
+
# rspec configuration is turned on, regardless of which notification lines
|
160
|
+
# we ask for. We need to strip the codes from the diff part of the message
|
161
|
+
# for XML output here.
|
162
|
+
#
|
163
|
+
# We also only want to target the diff hunks because the failure message
|
164
|
+
# itself might legitimately contain ansi escape codes.
|
165
|
+
#
|
166
|
+
string.sub(STRIP_DIFF_COLORS_BLOCK_REGEXP) { |match| match.gsub(STRIP_DIFF_COLORS_CODES_REGEXP, "".freeze) }
|
167
|
+
end
|
152
168
|
end
|
153
169
|
|
154
170
|
RspecJunitFormatter = RSpecJUnitFormatter
|
@@ -47,18 +47,19 @@ private
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def failure_message_for(example)
|
50
|
-
exception_for(example).to_s
|
50
|
+
strip_diff_colors(exception_for(example).to_s)
|
51
51
|
end
|
52
52
|
|
53
53
|
def failure_for(example)
|
54
54
|
exception = exception_for(example)
|
55
|
+
message = strip_diff_colors(exception.message)
|
55
56
|
backtrace = format_backtrace(exception.backtrace, example)
|
56
57
|
|
57
58
|
if shared_group = find_shared_group(example)
|
58
59
|
backtrace << "Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\" called from #{shared_group.metadata[:example_group][:location]}"
|
59
60
|
end
|
60
61
|
|
61
|
-
"#{
|
62
|
+
"#{message}\n#{backtrace.join("\n")}"
|
62
63
|
end
|
63
64
|
|
64
65
|
def find_shared_group(example)
|
@@ -84,45 +84,42 @@ private
|
|
84
84
|
notification.example.execution_result.exception
|
85
85
|
end
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
# contain ANSI escape codes for colorizing terminal output if the global
|
93
|
-
# rspec configuration is turned on, regardless of which notification lines
|
94
|
-
# we ask for. We need to strip the codes from the diff part of the message
|
95
|
-
# for XML output here.
|
96
|
-
#
|
97
|
-
# We also only want to target the diff hunks because the failure message
|
98
|
-
# itself might legitimately contain ansi escape codes.
|
99
|
-
#
|
100
|
-
string.sub(STRIP_DIFF_COLORS_BLOCK_REGEXP) { |match| match.gsub(STRIP_DIFF_COLORS_CODES_REGEXP, "".freeze) }
|
101
|
-
end
|
102
|
-
|
103
|
-
# Completely gross hack for forcing off colorising
|
104
|
-
if Gem::Version.new(RSpec::Core::Version::STRING) >= Gem::Version.new("3.6")
|
105
|
-
WITHOUT_COLOR_KEY = :color_mode
|
106
|
-
WITHOUT_COLOR_VALUE = :off
|
107
|
-
else
|
108
|
-
WITHOUT_COLOR_KEY = :color
|
109
|
-
WITHOUT_COLOR_VALUE = false
|
110
|
-
end
|
111
|
-
def without_color
|
87
|
+
# rspec makes it really difficult to swap in configuration temporarily due to
|
88
|
+
# the way it cascades defaults, command line arguments, and user
|
89
|
+
# configuration. This method makes sure configuration gets swapped in
|
90
|
+
# correctly, but also that the original state is definitely restored.
|
91
|
+
def swap_rspec_configuration(key, value)
|
112
92
|
unset = Object.new
|
113
|
-
force = RSpec.configuration.send(:value_for,
|
93
|
+
force = RSpec.configuration.send(:value_for, key) { unset }
|
114
94
|
if unset.equal?(force)
|
115
|
-
previous = RSpec.configuration.send(
|
116
|
-
RSpec.configuration.send(:"#{
|
95
|
+
previous = RSpec.configuration.send(key)
|
96
|
+
RSpec.configuration.send(:"#{key}=", value)
|
117
97
|
else
|
118
|
-
RSpec.configuration.force({
|
98
|
+
RSpec.configuration.force({key => value})
|
119
99
|
end
|
120
100
|
yield
|
121
101
|
ensure
|
122
102
|
if unset.equal?(force)
|
123
|
-
RSpec.configuration.send(:"#{
|
103
|
+
RSpec.configuration.send(:"#{key}=", previous)
|
124
104
|
else
|
125
|
-
RSpec.configuration.force({
|
105
|
+
RSpec.configuration.force({key => force})
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Completely gross hack for absolutely forcing off colorising for the
|
110
|
+
# duration of a block.
|
111
|
+
if RSpec.configuration.respond_to?(:color_mode=)
|
112
|
+
def without_color(&block)
|
113
|
+
swap_rspec_configuration(:color_mode, :off, &block)
|
114
|
+
end
|
115
|
+
elsif RSpec.configuration.respond_to?(:color=)
|
116
|
+
def without_color(&block)
|
117
|
+
swap_rspec_configuration(:color, false, &block)
|
118
|
+
end
|
119
|
+
else
|
120
|
+
warn 'rspec_junit_formatter cannot prevent colorising due to an unexpected RSpec.configuration format'
|
121
|
+
def without_color
|
122
|
+
yield
|
126
123
|
end
|
127
124
|
end
|
128
125
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_junit_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Cochran
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
P4lSfmXxsd1C71ckIp0cyXkPhyTtpyS/5hq9HhuUNzEHkSDe36/Rd1xYKV5JxMC2
|
29
29
|
YAttWFUs06lor2q1wwncPaMtUtbWwW35+1IV6xhs2rFY6DD/I6ZkK3GnHdY=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2017-12-
|
31
|
+
date: 2017-12-17 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec-core
|
@@ -56,6 +56,20 @@ dependencies:
|
|
56
56
|
- - "!="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: 2.12.0
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: bundler
|
61
|
+
requirement: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - "~>"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '1.16'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.16'
|
59
73
|
- !ruby/object:Gem::Dependency
|
60
74
|
name: nokogiri
|
61
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,6 +84,34 @@ dependencies:
|
|
70
84
|
- - "~>"
|
71
85
|
- !ruby/object:Gem::Version
|
72
86
|
version: '1.6'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: rake
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '10.0'
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '10.0'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: coderay
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '1.0'
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '1.0'
|
73
115
|
description: RSpec results that your continuous integration service can read.
|
74
116
|
email: sj26@sj26.com
|
75
117
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|