def extract_jasmine_summary(line):
    """
    Example SUCCESS karma summary line:
    PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 SUCCESS (0.205 secs / 0.001 secs)
    Exmaple FAIL karma summary line:
    PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.21 secs / 0.001 secs)
    """
    # get totals
    totals = line.split(' Executed ')[1].split(' ')
    executed_tests, total_tests = int(totals[0]), int(totals[2])

    # get failed
    if 'SUCCESS' in line:
        failed_tests = 0
    else:
        failed_tests = int(totals[3][1:])

    return {
        'total_tests': total_tests,
        'executed_tests': executed_tests,
        'failed_tests': failed_tests,
        'passed_tests': executed_tests - failed_tests
    }