Sha256: eea4b1922caa13eb0949894f340e7b04b68ae477bddf829489c04708bc59ae1d

Contents?: true

Size: 745 Bytes

Versions: 129

Compression:

Stored size: 745 Bytes

Contents

require_relative 'module'

module Scan
  class TestResultParser
    def parse_result(output)
      unless output
        return {
            tests: 0,
            failures: 0
        }
      end

      # e.g. ...<testsuites tests='2' failures='1'>...
      matched = output.scan(/<testsuites\b(?=[^<>]*\s+tests='(\d+)')(?=[^<>]*\s+failures='(\d+)')[^<>]+>/)

      if matched && matched.length == 1 && matched[0].length == 2
        tests = matched[0][0].to_i
        failures = matched[0][1].to_i

        {
          tests: tests,
          failures: failures
        }
      else
        UI.error("Couldn't parse the number of tests from the output")
        {
          tests: 0,
          failures: 0
        }
      end
    end
  end
end

Version data entries

129 entries across 129 versions & 4 rubygems

Version Path
fastlane-2.226.0 scan/lib/scan/test_result_parser.rb
fastlane-2.225.0 scan/lib/scan/test_result_parser.rb
fastlane-2.224.0 scan/lib/scan/test_result_parser.rb
fastlane-2.223.1 scan/lib/scan/test_result_parser.rb
fastlane-2.223.0 scan/lib/scan/test_result_parser.rb
fastlane-2.222.0 scan/lib/scan/test_result_parser.rb
fastlane-2.221.1 scan/lib/scan/test_result_parser.rb
fastlane-2.221.0 scan/lib/scan/test_result_parser.rb
fastlane-2.220.0 scan/lib/scan/test_result_parser.rb
fastlane-2.219.0 scan/lib/scan/test_result_parser.rb
fastlane-2.218.0 scan/lib/scan/test_result_parser.rb
fastlane-security-patched-2.216.0 scan/lib/scan/test_result_parser.rb
fastlane-2.217.0 scan/lib/scan/test_result_parser.rb
fastlane-2.216.0 scan/lib/scan/test_result_parser.rb
fastlane-2.215.1 scan/lib/scan/test_result_parser.rb
fastlane-2.215.0 scan/lib/scan/test_result_parser.rb
fastlane-mercafacil-2.214.0 scan/lib/scan/test_result_parser.rb
fastlane-2.214.0 scan/lib/scan/test_result_parser.rb
fastlane-2.213.0 scan/lib/scan/test_result_parser.rb
fastlane-2.212.2 scan/lib/scan/test_result_parser.rb