jasmine_junitxml_formatter 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c4e7e17241b1f88441887ea352b5c41ac715a0b
4
- data.tar.gz: e3eff5baf42ec5d62eac7e61b3d4b17a08c167ca
3
+ metadata.gz: 77ee4ffac1f3fd7c97c6f6731c54942763cc3eed
4
+ data.tar.gz: 94546eefa038c39efd91a62f8962262e64aea2ef
5
5
  SHA512:
6
- metadata.gz: 1a4c162c3e996c64ed3c9d76afcc4a2d41fa7a2f2f5d9a5149684590226b3c2e431e89ee96bcaf06f3fec4be983c389225afb451960139a74c4c2351dbfe811b
7
- data.tar.gz: 3371edc7e0e3fb6e86dd08474e0d0d4e3d2b816838f3a398d6a260463c20241a6344c8be9b39bf3581836099244f4b71abec4d5b13230b8366d1301c010eb2aa
6
+ metadata.gz: 661aeee67d75d77be8555d50199731191298d19a44fd18aa159f323ce78a8c5cf17fead3be1a65f3e77bb92468b43887ed028b4f9575187f7992b7c6a9620e42
7
+ data.tar.gz: 7fc0fbab7ebcc178717393fd373ad43f906f25dafcca23890f97628dd4d3e21ebc67a41b887d70b0340894e13e0d1b26b1d120392bcf359a06052500a987c04a
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ sudo: false
3
+
4
+ rvm:
5
+ - "1.9.3"
6
+ - "2.0.0"
7
+ - "2.1.1"
8
+ - "jruby"
9
+ - "rbx-2"
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'rspec'
23
23
  spec.add_development_dependency "rake"
24
24
 
25
- spec.add_dependency 'jasmine', '~> 2.0'
25
+ spec.add_dependency 'jasmine', '~> 2.4'
26
26
  spec.add_dependency "nokogiri"
27
27
  end
@@ -5,24 +5,22 @@ module Jasmine
5
5
  class JunitXml
6
6
  def initialize
7
7
  load_config ENV['JASMINE_JUNIT_XML_CONFIG_PATH']
8
- @doc = Nokogiri::XML '<testsuites></testsuites>', nil, 'UTF-8'
8
+ @doc = Nokogiri::XML '<testsuites><testsuite name="Jasmine Suite"></testsuite></testsuites>', nil, 'UTF-8'
9
+ @spec_count = 0
10
+ @failure_count = 0
9
11
  end
10
12
 
11
13
  def format(results)
12
- testsuites = doc.at_css('testsuites')
14
+ testsuite = doc.at_css('testsuites testsuite')
13
15
 
14
- results.each do |result|
15
- testsuite = Nokogiri::XML::Node.new 'testsuite', doc
16
- testsuite['tests'] = 1
17
- testsuite['failures'] = result.failed? ? 1 : 0
18
- testsuite['errors'] = 0
19
- testsuite['name'] = result.suite_name
20
- testsuite.parent = testsuites
16
+ @spec_count += results.size
21
17
 
18
+ results.each do |result|
22
19
  testcase = Nokogiri::XML::Node.new 'testcase', doc
23
20
  testcase['name'] = result.description
24
21
 
25
22
  if result.failed?
23
+ @failure_count += 1
26
24
  result.failed_expectations.each do |failed_exp|
27
25
  failure = Nokogiri::XML::Node.new 'failure', doc
28
26
  failure['message'] = failed_exp.message
@@ -36,7 +34,31 @@ module Jasmine
36
34
  end
37
35
  end
38
36
 
39
- def done(run_details={})
37
+ def done(run_details)
38
+ testsuite = doc.at_css('testsuites testsuite')
39
+ properties = Nokogiri::XML::Node.new 'properties', doc
40
+ properties.parent = testsuite
41
+
42
+ if run_details['order']
43
+ random = Nokogiri::XML::Node.new 'property', doc
44
+ random['name'] = 'random'
45
+ random['value'] = run_details['order']['random']
46
+
47
+ random.parent = properties
48
+
49
+ if run_details['order']['random']
50
+ seed = Nokogiri::XML::Node.new 'property', doc
51
+ seed['name'] = 'seed'
52
+ seed['value'] = run_details['order']['seed']
53
+
54
+ seed.parent = properties
55
+ end
56
+ end
57
+
58
+ testsuite['tests'] = @spec_count
59
+ testsuite['failures'] = @failure_count
60
+ testsuite['errors'] = 0
61
+
40
62
  FileUtils.mkdir_p(output_dir)
41
63
  File.open(File.join(output_dir, 'junit_results.xml'), 'w') do |file|
42
64
  file.puts doc.to_xml(indent: 2)
@@ -1,3 +1,3 @@
1
1
  module JasmineJunitxmlFormatter
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,12 @@
1
+ # Jasmine JUnix XML Reporter 1.0.0 Release Notes
2
+
3
+ ## Changes
4
+
5
+ * Restructure xml to bring all specs under a single testsuite
6
+
7
+ * Include randomization info as properties for the suite
8
+
9
+
10
+ ------
11
+
12
+ _Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
@@ -34,13 +34,13 @@ describe Jasmine::Formatters::JunitXml do
34
34
  subject = Jasmine::Formatters::JunitXml.new
35
35
 
36
36
  subject.format(results)
37
- subject.done
37
+ subject.done({})
38
38
  xml = Nokogiri::XML(file_stub.content)
39
39
 
40
40
  testsuite = xml.xpath('/testsuites/testsuite').first
41
41
  expect(testsuite['tests']).to eq '1'
42
42
  expect(testsuite['failures']).to eq '0'
43
- expect(testsuite['name']).to eq 'Passing'
43
+ expect(testsuite['name']).to eq 'Jasmine Suite'
44
44
 
45
45
  expect(xml.xpath('//testcase').size).to eq 1
46
46
  expect(xml.xpath('//testcase').first['name']).to eq 'test'
@@ -55,15 +55,12 @@ describe Jasmine::Formatters::JunitXml do
55
55
 
56
56
  subject.format(results1)
57
57
  subject.format(results2)
58
- subject.done
58
+ subject.done({})
59
59
  xml = Nokogiri::XML(file_stub.content)
60
60
 
61
+ expect(xml.xpath('/testsuites/testsuite').size).to eq(1)
61
62
  testsuite = xml.xpath('/testsuites/testsuite').first
62
- expect(testsuite['tests']).to eq '1'
63
- expect(testsuite['failures']).to eq '0'
64
-
65
- testsuite = xml.xpath('/testsuites/testsuite')[1]
66
- expect(testsuite['tests']).to eq '1'
63
+ expect(testsuite['tests']).to eq '2'
67
64
  expect(testsuite['failures']).to eq '1'
68
65
 
69
66
  expect(xml.xpath('//testcase').size).to eq 2
@@ -74,11 +71,28 @@ describe Jasmine::Formatters::JunitXml do
74
71
  end
75
72
 
76
73
  describe 'with randomization information' do
77
- it 'still works' do
74
+ it 'includes randomization seed when randomized' do
78
75
  subject.format([])
79
- expect {
80
- subject.done({'order' => {'random' => true, 'seed' => '4321'}})
81
- }.not_to raise_error
76
+ subject.done({'order' => {'random' => true, 'seed' => '4321'}})
77
+ xml = Nokogiri::XML(file_stub.content)
78
+
79
+ testsuite = xml.xpath('/testsuites/testsuite').first
80
+ properties = testsuite.xpath('properties')
81
+
82
+ expect(properties.xpath("property[@name='random']").first['value']).to eq('true')
83
+ expect(properties.xpath("property[@name='seed']").first['value']).to eq('4321')
84
+ end
85
+
86
+ it 'does not include a seed when not randomized' do
87
+ subject.format([])
88
+ subject.done({'order' => {'random' => false}})
89
+ xml = Nokogiri::XML(file_stub.content)
90
+
91
+ testsuite = xml.xpath('/testsuites/testsuite').first
92
+ properties = testsuite.xpath('properties')
93
+
94
+ expect(properties.xpath("property[@name='random']").first['value']).to eq('false')
95
+ expect(properties.xpath("property[@name='seed']").size).to eq(0)
82
96
  end
83
97
  end
84
98
  end
@@ -101,7 +115,7 @@ YAML
101
115
  subject = Jasmine::Formatters::JunitXml.new
102
116
 
103
117
  subject.format(results)
104
- subject.done
118
+ subject.done({})
105
119
  expect(file_stub.content).to_not eq ''
106
120
  end
107
121
 
@@ -110,7 +124,7 @@ YAML
110
124
 
111
125
  subject.format([])
112
126
  expect(FileUtils).to receive(:mkdir_p).with('/custom_path')
113
- subject.done
127
+ subject.done({})
114
128
  end
115
129
  end
116
130
 
@@ -138,14 +152,14 @@ YAML
138
152
  results = [passing_result('fullName' => 'Passing test', 'description' => 'test')]
139
153
 
140
154
  subject.format(results)
141
- subject.done
155
+ subject.done({})
142
156
  expect(file_stub.content).to_not eq ''
143
157
  end
144
158
 
145
159
  it 'creates the directory if it does not exist' do
146
160
  subject.format([])
147
161
  expect(FileUtils).to receive(:mkdir_p).with('/other_custom_path')
148
- subject.done
162
+ subject.done({})
149
163
  end
150
164
  end
151
165
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine_junitxml_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Van Hove
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.0'
61
+ version: '2.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: '2.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: nokogiri
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +89,8 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
92
94
  - Gemfile
93
95
  - LICENSE
94
96
  - README.md
@@ -101,6 +103,7 @@ files:
101
103
  - lib/jasmine_junitxml_formatter/tasks/jasmine_junitxml_formatter.rake
102
104
  - lib/jasmine_junitxml_formatter/version.rb
103
105
  - release_notes/0.3.0.md
106
+ - release_notes/1.0.0.md
104
107
  - spec/lib/jasmine/formatters/junit_xml_spec.rb
105
108
  - spec/spec_helper.rb
106
109
  homepage: https://github.com/jasmine/jasmine_junitxml_formatter