test-unit-runner-junitxml 0.2.0 → 1.0.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: dcc822c3eb15c8429e1bf4a416b8d851445949fdcd70e911e978c54e93ef185f
4
- data.tar.gz: 9019e7126e6c0d038ee23596de5c94e9b0151cd49cad5c295b94535991fd5a8b
3
+ metadata.gz: 1d80ec066b99b905b45f634d5f5c77de818136eb4840cc460bc5cd94e1c4b2a6
4
+ data.tar.gz: a15d2feb6b5cd2cbfc15e9a5187c6f5fd8ef3991bbf4235123ed74fb23553006
5
5
  SHA512:
6
- metadata.gz: cccd48257f5637df20b4e1df12a9018dce9a60b93c00743291cd841c212dcc97929de63863a65013b4813068e06f6d4fe0bf34c4b220cbc349ce100540b12051
7
- data.tar.gz: b2d1012a3d79972dea86c3e3c05815e0f87293386b39d188b9672c19a692385964816a60924b5207296ebe0a8860f47a0faaa358e88d25c9513d520025aa96a5
6
+ metadata.gz: 47fe6a5c24941dd8b685e0265008384d5728f239695303371e8bdf356c0c984dbd11dae4bc4a6ffa8eafad37bab796b9ba29dce3aa73f239b13b585cd03549eb
7
+ data.tar.gz: 7c42cc465c212a4d6fc7ff40485e765e0fe0b200d3a2bb8026d049f40c65518e1a4010c4261d6827ec8fb8ecb0c6aa143cc25394660a4062cc2d0cc87b18003e
@@ -7,21 +7,28 @@ on:
7
7
  schedule:
8
8
  - cron: '34 18 * * *'
9
9
  jobs:
10
+ ruby-versions:
11
+ uses: ruby/actions/.github/workflows/ruby_versions.yml@master
10
12
  rake-test:
13
+ needs: ruby-versions
11
14
  strategy:
12
15
  fail-fast: false
13
16
  matrix:
14
17
  os: [ubuntu-latest, macos-latest, windows-latest]
15
- ruby: [head, 3.1, 3.0, 2.7, 2.6, jruby, truffleruby]
18
+ ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
16
19
  exclude:
17
20
  - os: windows-latest
18
- ruby: 3.1
21
+ ruby: jruby
22
+ - os: windows-latest
23
+ ruby: jruby-head
19
24
  - os: windows-latest
20
25
  ruby: truffleruby
26
+ - os: windows-latest
27
+ ruby: truffleruby-head
21
28
  runs-on: ${{ matrix.os }}
22
29
  # continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
23
30
  steps:
24
- - uses: actions/checkout@v2
31
+ - uses: actions/checkout@v3
25
32
  - uses: ruby/setup-ruby@v1
26
33
  with:
27
34
  ruby-version: ${{ matrix.ruby }}
data/README.ja.md CHANGED
@@ -33,8 +33,8 @@ $ ruby test.rb --runner=junitxml --junitxml-output-file=result.xml
33
33
  $ cat result.xml
34
34
  <?xml version="1.0" encoding="UTF-8" ?>
35
35
  <testsuites>
36
- <testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.005365">
37
- <testcase classname="MyTest" name="test_1(MyTest)" time="0.0053308" assertions="1">
36
+ <testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.0037614">
37
+ <testcase classname="MyTest" name="test_1(MyTest)" file="test.rb" time="0.0036311" assertions="1">
38
38
  <failure message="&lt;1&gt; expected but was
39
39
  &lt;2&gt;.">Failure:
40
40
  test_1(MyTest) [test.rb:7]:
data/README.md CHANGED
@@ -33,8 +33,8 @@ $ ruby test.rb --runner=junitxml --junitxml-output-file=result.xml
33
33
  $ cat result.xml
34
34
  <?xml version="1.0" encoding="UTF-8" ?>
35
35
  <testsuites>
36
- <testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.005365">
37
- <testcase classname="MyTest" name="test_1(MyTest)" time="0.0053308" assertions="1">
36
+ <testsuite name="MyTest" tests="1" errors="0" failures="1" skipped="0" time="0.0037614">
37
+ <testcase classname="MyTest" name="test_1(MyTest)" file="test.rb" time="0.0036311" assertions="1">
38
38
  <failure message="&lt;1&gt; expected but was
39
39
  &lt;2&gt;.">Failure:
40
40
  test_1(MyTest) [test.rb:7]:
@@ -2,7 +2,7 @@ module Test
2
2
  module Unit
3
3
  module Runner
4
4
  module Junitxml
5
- VERSION = "0.2.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
8
8
  end
@@ -15,6 +15,7 @@ module Test
15
15
  def initialize(suite, options={})
16
16
  super
17
17
  @junit_test_suites = []
18
+ @base_dir_re = /\A#{Regexp.quote(Dir.pwd)}\//
18
19
  end
19
20
 
20
21
  private
@@ -49,7 +50,7 @@ module Test
49
50
  end
50
51
 
51
52
  def test_started(test)
52
- test_case = JUnitTestCase.new(test.class.name, test.description)
53
+ test_case = JUnitTestCase.new(test.class.name, test.description, test_file(test))
53
54
  @junit_test_suites.last << test_case
54
55
  unless @options[:junitxml_disable_output_capture]
55
56
  @stdout_org = $stdout
@@ -59,6 +60,12 @@ module Test
59
60
  end
60
61
  end
61
62
 
63
+ def test_file(test)
64
+ file = (test[:source_location] ||
65
+ test.method(test.method_name).source_location).first
66
+ file.sub(@base_dir_re, "")
67
+ end
68
+
62
69
  def test_finished(test)
63
70
  @junit_test_suites.last.test_cases.last.time = test.elapsed_time
64
71
  unless @options[:junitxml_disable_output_capture]
@@ -125,14 +132,15 @@ module Test
125
132
  end
126
133
 
127
134
  class JUnitTestCase
128
- attr_reader :class_name, :name
135
+ attr_reader :class_name, :name, :file
129
136
  attr_reader :failure, :error, :omission, :pending
130
137
  attr_reader :stdout, :stderr
131
138
  attr_accessor :assertion_count, :time
132
139
 
133
- def initialize(class_name, name)
140
+ def initialize(class_name, name, file)
134
141
  @class_name = class_name
135
142
  @name = name
143
+ @file = file
136
144
  @failure = @error = @omission = @pending = nil
137
145
  @stdout = StringIO.new
138
146
  @stderr = StringIO.new
@@ -3,7 +3,7 @@
3
3
  % @junit_test_suites.each do |test_suite|
4
4
  <testsuite name="<%=h test_suite.name %>" tests="<%=h test_suite.test_cases.size %>" errors="<%=h test_suite.errors.size %>" failures="<%=h test_suite.failures.size %>" skipped="<%=h test_suite.test_cases.count(&:skipped?) %>" time="<%=h test_suite.time %>">
5
5
  % test_suite.test_cases.each do |test_case|
6
- <testcase classname="<%=h test_case.class_name %>" name="<%=h test_case.name %>" time="<%=h test_case.time %>" assertions="<%=h test_case.assertion_count %>">
6
+ <testcase classname="<%=h test_case.class_name %>" name="<%=h test_case.name %>" file="<%=h test_case.file%>" time="<%=h test_case.time %>" assertions="<%=h test_case.assertion_count %>">
7
7
  % if test_case.error
8
8
  <error message="<%=h test_case.error.message %>" type="<%=h test_case.error.exception.class.name %>"><%=h test_case.error.long_display %></error>
9
9
  % elsif test_case.failure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-unit-runner-junitxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OGAWA KenIchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2023-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler