Sha256: b2698df5e92e35abc2c44e11a9e709e2ae4cc12bbaf249d7797dd5cec0f718d1

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

class JsTestDriverParser
  
  def parse_result(detail)
    summary_line = detail.grep( /Total \d+ tests/ )[0]
    
    if summary_line.nil?
      # error
      error_info = (detail + "\nUnknown Error!").to_a[0].strip
      return :error, 'Error', error_info
    end
    
    if summary_line =~ /Errors: ([1-9]+)/
      num_errors = $1
      error_info = detail.grep(/error \([0-9]+.[0-9]+ ms\)/)[0].strip
      return :failure, num_errors + ' Errors', error_info
    end

    if summary_line =~ /Fails: ([1-9]+)/
      num_failures = $1
      error_info = detail.grep(/failed \([0-9]+.[0-9]+ ms\)/)[0].strip
      return :failure, num_failures + ' Failures', error_info
    end
    
    return :success, 'All tests pass', ''
    
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
karl-loris-0.0.10 lib/tasks/js_test_driver/js_test_driver_parser.rb
karl-loris-0.0.11 lib/tasks/js_test_driver/js_test_driver_parser.rb
loris-0.0.12 lib/tasks/js_test_driver/js_test_driver_parser.rb