minitest_reporters_github 1.0.0 → 1.1.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e97df0f92108af3788508fa77e5b611fb117fb97f7f1d7a84c9f324fb68aaed
|
|
4
|
+
data.tar.gz: c1773aaf1b59cd8a9bc2d92633be27cf0675bca6473e6d0ec8c3ccbcdd0a46ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b923bf033a47da11e4694b4cf0875ff17322c6c440ec7e1f5214508303a4ca30493e19fa4df7912e2f19e32fd383986439feed603dc9ec1dee62a9a068602ba
|
|
7
|
+
data.tar.gz: 25b561dfbd2b4755a1de8c5ad1eb1677d78c88f10e9bb27a84130a94607144e037d997295d02ce3d1c26da4bfc4e04738fcc1789394cc43f1ad777cdfc7d6229
|
|
@@ -9,7 +9,9 @@ require 'minitest/reporters'
|
|
|
9
9
|
|
|
10
10
|
# Simple reporter designed for Github Actions
|
|
11
11
|
class MinitestReportersGithub < Minitest::Reporters::BaseReporter
|
|
12
|
-
|
|
12
|
+
# based on https://github.com/actions/toolkit/blob/cee7d92d1d02e3107c9b1387b9690b89096b67be/packages/core/src/command.ts#L92-L105
|
|
13
|
+
ESCAPE_DATA_MAP = { '%' => '%25', "\n" => '%0A', "\r" => '%0D' }.freeze
|
|
14
|
+
ESCAPE_PROPERTY_MAP = ESCAPE_DATA_MAP.merge({ ':' => '%3A', ',' => '%2C'}).freeze
|
|
13
15
|
|
|
14
16
|
def start
|
|
15
17
|
super
|
|
@@ -36,18 +38,24 @@ class MinitestReportersGithub < Minitest::Reporters::BaseReporter
|
|
|
36
38
|
private
|
|
37
39
|
|
|
38
40
|
def to_annotation(test, failure_type)
|
|
39
|
-
|
|
41
|
+
title = "#{test.class_name}##{test.name}"
|
|
42
|
+
message = "#{failure_type}: #{title}\n\n#{test.failure.message}"
|
|
40
43
|
line_number = location(test.failure).split(":").last
|
|
41
44
|
|
|
42
|
-
"\n::error file=%<file>s,line=%<line>d::%<message>s\n" % {
|
|
45
|
+
"\n::error file=%<file>s,line=%<line>d,title=%<title>s::%<message>s\n" % {
|
|
43
46
|
file: get_relative_path(test),
|
|
44
47
|
line: line_number,
|
|
45
|
-
|
|
48
|
+
title: github_property_escape(title),
|
|
49
|
+
message: github_data_escape(message.rstrip),
|
|
46
50
|
}
|
|
47
51
|
end
|
|
48
52
|
|
|
49
|
-
def
|
|
50
|
-
string.gsub(Regexp.union(
|
|
53
|
+
def github_property_escape(string)
|
|
54
|
+
string.gsub(Regexp.union(ESCAPE_PROPERTY_MAP.keys), ESCAPE_PROPERTY_MAP)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def github_data_escape(string)
|
|
58
|
+
string.gsub(Regexp.union(ESCAPE_DATA_MAP.keys), ESCAPE_DATA_MAP)
|
|
51
59
|
end
|
|
52
60
|
|
|
53
61
|
def get_source_location(result)
|
|
@@ -61,7 +69,7 @@ class MinitestReportersGithub < Minitest::Reporters::BaseReporter
|
|
|
61
69
|
def location(exception)
|
|
62
70
|
last_before_assertion = ''
|
|
63
71
|
exception.backtrace.reverse_each do |s|
|
|
64
|
-
break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
|
|
72
|
+
break if s =~ /in .(Minitest::Assertions#)?(assert|refute|flunk|pass|fail|raise|must|wont)/
|
|
65
73
|
|
|
66
74
|
last_before_assertion = s
|
|
67
75
|
end
|
|
@@ -6,6 +6,6 @@ class MinitestReportersGithubTest < Minitest::Test
|
|
|
6
6
|
test_filename = File.join(fixtures_directory, 'github_actions_test.rb')
|
|
7
7
|
output = `ruby #{test_filename} 2>&1`
|
|
8
8
|
refute_match 'test_assertion', output
|
|
9
|
-
assert_match '::error file=test/fixtures/github_actions_test.rb,line=
|
|
9
|
+
assert_match '::error file=test/fixtures/github_actions_test.rb,line=16,title=TestClass#test_fail::Failure: TestClass#test_fail', output
|
|
10
10
|
end
|
|
11
11
|
end
|
metadata
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minitest_reporters_github
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ewoud Kohl van Wijngaarden
|
|
8
8
|
- Earlopain
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: minitest-reporters
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
16
|
requirements:
|
|
18
|
-
- - "
|
|
17
|
+
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
19
|
version: 1.6.0
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 1.8.0
|
|
21
23
|
type: :runtime
|
|
22
24
|
prerelease: false
|
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
26
|
requirements:
|
|
25
|
-
- - "
|
|
27
|
+
- - ">="
|
|
26
28
|
- !ruby/object:Gem::Version
|
|
27
29
|
version: 1.6.0
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 1.8.0
|
|
28
33
|
- !ruby/object:Gem::Dependency
|
|
29
34
|
name: rake
|
|
30
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,9 +44,8 @@ dependencies:
|
|
|
39
44
|
- - "~>"
|
|
40
45
|
- !ruby/object:Gem::Version
|
|
41
46
|
version: '13.0'
|
|
42
|
-
description: A separate gem until https://github.com/minitest-reporters/minitest-reporters/
|
|
43
|
-
is
|
|
44
|
-
email:
|
|
47
|
+
description: A separate gem until https://github.com/minitest-reporters/minitest-reporters/issues/330
|
|
48
|
+
is resolved
|
|
45
49
|
executables: []
|
|
46
50
|
extensions: []
|
|
47
51
|
extra_rdoc_files: []
|
|
@@ -51,11 +55,10 @@ files:
|
|
|
51
55
|
- test/fixtures/github_actions_test.rb
|
|
52
56
|
- test/integration/github_actions_reporter_test.rb
|
|
53
57
|
- test/test_helper.rb
|
|
54
|
-
homepage: https://github.com/
|
|
58
|
+
homepage: https://github.com/theforeman/minitest_reporters_github
|
|
55
59
|
licenses:
|
|
56
60
|
- MIT
|
|
57
61
|
metadata: {}
|
|
58
|
-
post_install_message:
|
|
59
62
|
rdoc_options: []
|
|
60
63
|
require_paths:
|
|
61
64
|
- lib
|
|
@@ -73,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
73
76
|
- !ruby/object:Gem::Version
|
|
74
77
|
version: '0'
|
|
75
78
|
requirements: []
|
|
76
|
-
rubygems_version:
|
|
77
|
-
signing_key:
|
|
79
|
+
rubygems_version: 4.0.3
|
|
78
80
|
specification_version: 4
|
|
79
81
|
summary: The GitHub Actions reporter for minitest-reporters
|
|
80
82
|
test_files: []
|