fastlane-plugin-xcode_test_reporter 0.1.3 → 0.1.4

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: 016720f120ddb224e6103921814241014503be4fcb0122df1078b461b38640fc
4
- data.tar.gz: 29517a6dd9e7adf082568f64c494b651453da634200a046406948d531e1c286b
3
+ metadata.gz: a7baa38123f0c18c411849475491a0ed97905a3cdec4335b83343b1c534dc674
4
+ data.tar.gz: 8f2a6cde89e5cdbbefe39262ddc9deb09781697198ac8963b30b5dba59f9fd74
5
5
  SHA512:
6
- metadata.gz: '019cfdf2801edf590d29ad6bd5e7109d5f4281dd9d9bfc9fa952b304ce35627aacf0b01af241fccbcfb3ee75192ec70d5eca48e9076805c70acbeacfaced7ab1'
7
- data.tar.gz: 2b819d4eab6b2c4644a0046fc192635a81bfcc410c5a004070a25ed74b5c80792606361748fcb14d7b1c25555915a7fe8bdd0eb565bcb618344c8d7a14c15f8a
6
+ metadata.gz: 6d7623caa4a07207a4e7dda5b6c3ac2e0e797ac253b28692957017f76d6a3ea071ea1218c3e88ce399afbc97934630844af6ad95d3291c475dd2cb68ce47ca66
7
+ data.tar.gz: 6a90287a886cb38f0d28ab240c8846592cea970ef46ab8e61bc9d4ff57b4426b881af8e14f3142ade4d82a5225978c229d64c429b0763bf54de200570667ce16
@@ -1,5 +1,6 @@
1
1
  require 'fastlane/action'
2
2
  require 'shellwords'
3
+ require 'json'
3
4
  require_relative '../helper/xcode_test_reporter_helper'
4
5
 
5
6
  module Fastlane
@@ -13,14 +14,28 @@ module Fastlane
13
14
  options['--output-directory'] = params[:output_directory] if params[:output_directory]
14
15
  options['--path'] = params[:path] if params[:path]
15
16
  options['--format'] = params[:format] if params[:format]
17
+ options['--output-json'] = true
16
18
 
17
- options_str = options.map { |k, v| "#{k} #{v.shellescape}" }.join(' ')
19
+ options_str = options.map do |k, v|
20
+ v.is_a?(String) ? "#{k} #{v.shellescape}" : "#{k}"
21
+ end.join(' ')
18
22
 
19
23
  command = "#{xcode_reporter_path} #{options_str}"
20
24
 
21
- unless system(command)
25
+ resultText = `#{command}`
26
+ unless $?.success?
22
27
  UI.user_error!("xcode-test-reporter command failed.")
23
28
  end
29
+
30
+ result = {}
31
+ JSON.parse(resultText).each
32
+ result.each do |report|
33
+ result[report["file"]] = report["success"]
34
+ UI.message "Generated: #{report["file"]}"
35
+ UI.test_failure!("Tests failed") if fail_build && !report["success"]
36
+ end
37
+
38
+ return result
24
39
  end
25
40
 
26
41
  def self.xcode_reporter_path
@@ -55,11 +70,17 @@ module Fastlane
55
70
  description: "Path containing the plist files",
56
71
  optional: true,
57
72
  type: String),
58
- FastlaneCore::ConfigItem.new(key: :path,
73
+ FastlaneCore::ConfigItem.new(key: :format,
59
74
  env_name: "XCODE_TEST_REPORTER_FORMAT",
60
75
  description: "The report format to output for (one of 'html', 'junit', or comma-separated values)",
61
76
  default_value: "junit",
62
77
  optional: true,
78
+ type: String),
79
+ FastlaneCore::ConfigItem.new(key: :fail_build,
80
+ env_name: "XCODE_TEST_REPORTER_FAIL_BUILD",
81
+ description: "Should this step stop the build if the tests fail?",
82
+ default_value: false,
83
+ optional: true,
63
84
  type: String)
64
85
  ]
65
86
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module XcodeTestReporter
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-xcode_test_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taisuke Hori
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-02 00:00:00.000000000 Z
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry