From d3db347ab2f21a8f9cd0675b80341d86a2f1fe3d Mon Sep 17 00:00:00 2001 From: Jared Grubb Date: Sun, 13 Dec 2015 12:59:22 -0800 Subject: [PATCH 01/61] Formatter.finish: give formatters the ability to know the end --- bin/xcpretty | 1 + lib/xcpretty/formatters/formatter.rb | 3 +++ lib/xcpretty/printer.rb | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/bin/xcpretty b/bin/xcpretty index 4a2db92b..d9a094a4 100755 --- a/bin/xcpretty +++ b/bin/xcpretty @@ -81,5 +81,6 @@ STDIN.each_line do |line| reporters.each { |r| r.handle(line) } end +printer.finish reporters.each(&:finish) diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index 48be608e..d1a4db2a 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -78,6 +78,9 @@ def initialize(use_unicode, colorize) @parser = Parser.new(self) end + def finish + end + # Override if you want to catch something specific with your regex def pretty_format(text) parser.parse(text) diff --git a/lib/xcpretty/printer.rb b/lib/xcpretty/printer.rb index 34dc5bd7..e0c7d7b0 100644 --- a/lib/xcpretty/printer.rb +++ b/lib/xcpretty/printer.rb @@ -11,6 +11,10 @@ def initialize(params) @formatter = klass.new(params[:unicode], params[:colorize]) end + def finish + @formatter.finish + end + def pretty_print(text) formatted_text = formatter.pretty_format(text) unless formatted_text.empty? From b45518008360f98e8ac44cc2acc8b0ce22d489d5 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Mon, 21 Dec 2015 11:17:29 -0800 Subject: [PATCH 02/61] Add Reporter class --- lib/xcpretty/reporters/reporter.rb | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 lib/xcpretty/reporters/reporter.rb diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb new file mode 100644 index 00000000..fcad46e1 --- /dev/null +++ b/lib/xcpretty/reporters/reporter.rb @@ -0,0 +1,68 @@ +module XCPretty + +module ReporterMethods + EMPTY = ''.freeze + def handle(line); EMPTY; end + def finish; EMPTY; end + def write_report_file; EMPTY; end + def initialize(options); EMPTY; end + def handle(line); EMPTY; end +end + + class Reporter < Formatter + + def initialize(options) + @parser = Parser.new(self) + @filepath = options[:path] || FILEPATH + @total_tests = 0 + @total_fails = 0 + @test_suites = {} + end + + def handle(line) + @parser.parse(line) + end + + def finish + FileUtils.mkdir_p(File.dirname(@filepath)) + write_report + end + + def format_failing_test(suite, test_case, reason, file) + data = (name: test_case, failing: true, + reason: reason, file: file, + snippet: formatted_snippet(file)) + @test_count += 1 + @fail_count += 1 + @test_suites[suite] ||= {tests: []} + @test_suites[suite][:tests] << data + end + + def format_passing_test(suite, test_case, time) + data = (name: test_case, time: time) + @test_count += 1 + @test_suites[suite] ||= {tests: []} + @test_suites[suite][:tests] << data + end + + def format_pending_test(classname, test_case) + data = (name: test_case, time: time, pending: true) + @test_count += 1 + @test_suites[suite] ||= {tests: []} + @test_suites[suite][:tests] << data + end + + def write_report + File.open(@filepath, 'w') do |f| + # WAT: get rid of these locals. BTW Cucumber fails if you remove them + test_suites = @test_suites + fail_count = @fail_count + test_count = @test_count + erb = ERB.new(File.open(TEMPLATE, 'r').read) + f.write erb.result(binding) + end + end + + end + +end \ No newline at end of file From b39bb3f694013f0368c30d3e0cd3a2855f519e12 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 10:47:45 -0800 Subject: [PATCH 03/61] Finish reporter and add tests --- lib/xcpretty/reporters/reporter.rb | 33 +++++---------------- spec/xcpretty/reporters/reporter_spec.rb | 37 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 spec/xcpretty/reporters/reporter_spec.rb diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index fcad46e1..3393803a 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -1,14 +1,5 @@ module XCPretty -module ReporterMethods - EMPTY = ''.freeze - def handle(line); EMPTY; end - def finish; EMPTY; end - def write_report_file; EMPTY; end - def initialize(options); EMPTY; end - def handle(line); EMPTY; end -end - class Reporter < Formatter def initialize(options) @@ -16,7 +7,7 @@ def initialize(options) @filepath = options[:path] || FILEPATH @total_tests = 0 @total_fails = 0 - @test_suites = {} + @tests = [] end def handle(line) @@ -29,37 +20,27 @@ def finish end def format_failing_test(suite, test_case, reason, file) - data = (name: test_case, failing: true, - reason: reason, file: file, - snippet: formatted_snippet(file)) @test_count += 1 @fail_count += 1 - @test_suites[suite] ||= {tests: []} - @test_suites[suite][:tests] << data + @tests.append("#{test_case} in #{file} FAILED: #{reason}") end def format_passing_test(suite, test_case, time) - data = (name: test_case, time: time) @test_count += 1 - @test_suites[suite] ||= {tests: []} - @test_suites[suite][:tests] << data + @tests.append("#{test_case} PASSED") end def format_pending_test(classname, test_case) - data = (name: test_case, time: time, pending: true) @test_count += 1 - @test_suites[suite] ||= {tests: []} - @test_suites[suite][:tests] << data + @tests.append("#{test_case} in #{file} IS PENDING") end def write_report File.open(@filepath, 'w') do |f| # WAT: get rid of these locals. BTW Cucumber fails if you remove them - test_suites = @test_suites - fail_count = @fail_count - test_count = @test_count - erb = ERB.new(File.open(TEMPLATE, 'r').read) - f.write erb.result(binding) + output_string = @tests.join("\n") + output_string += "\n FINISHED RUNNING #{@total_tests} TESTS WITH #{@total_fails} FAILURES" + f.write output_string end end diff --git a/spec/xcpretty/reporters/reporter_spec.rb b/spec/xcpretty/reporters/reporter_spec.rb new file mode 100644 index 00000000..3d27bf27 --- /dev/null +++ b/spec/xcpretty/reporters/reporter_spec.rb @@ -0,0 +1,37 @@ +# encoding: utf-8 + +require 'xcpretty' +require 'fixtures/constants' + +module XCPretty + + describe Reporter do + before(:each) do + @reporter = Reporter.new(path: "example_file") + end + end + + it "reports a passing test" do + @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") + expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") + end + + it "reports a failing test" do + @reporter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file') + expect(@reporter.tests).to include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") + end + + it "reports a pending test" do + @reporter.format_pending_text("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object") + expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") + end + + it "writes to disk" do + @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") + + File.stub(:write) + @reporter.write_report + + expect(File).to have_received(:write).with("example_file", "_tupleByAddingObject__should_add_a_non_nil_object PASSED\nFINISHED RUNNING 1 TESTS WITH 0 FAILURES") + end +end \ No newline at end of file From 5c1fd0239fd2961c7e12bc6a4b671811077ff0ea Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 11:36:52 -0800 Subject: [PATCH 04/61] Passing tests --- lib/xcpretty.rb | 1 + lib/xcpretty/reporters/reporter.rb | 16 +++++----- spec/xcpretty/reporters/reporter_spec.rb | 39 +++++++++++++----------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/lib/xcpretty.rb b/lib/xcpretty.rb index 26c76549..f05b1991 100644 --- a/lib/xcpretty.rb +++ b/lib/xcpretty.rb @@ -8,6 +8,7 @@ require 'xcpretty/formatters/rspec' require 'xcpretty/formatters/knock' require 'xcpretty/formatters/tap' +require 'xcpretty/reporters/reporter' require 'xcpretty/reporters/junit' require 'xcpretty/reporters/html' require 'xcpretty/reporters/json_compilation_database' diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index 3393803a..024b41b6 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -2,11 +2,13 @@ module XCPretty class Reporter < Formatter + attr_reader :tests + def initialize(options) - @parser = Parser.new(self) + super(true, true) @filepath = options[:path] || FILEPATH - @total_tests = 0 - @total_fails = 0 + @test_count = 0 + @fail_count = 0 @tests = [] end @@ -22,24 +24,24 @@ def finish def format_failing_test(suite, test_case, reason, file) @test_count += 1 @fail_count += 1 - @tests.append("#{test_case} in #{file} FAILED: #{reason}") + @tests.push("#{test_case} in #{file} FAILED: #{reason}") end def format_passing_test(suite, test_case, time) @test_count += 1 - @tests.append("#{test_case} PASSED") + @tests.push("#{test_case} PASSED") end def format_pending_test(classname, test_case) @test_count += 1 - @tests.append("#{test_case} in #{file} IS PENDING") + @tests.push("#{test_case} IS PENDING") end def write_report File.open(@filepath, 'w') do |f| # WAT: get rid of these locals. BTW Cucumber fails if you remove them output_string = @tests.join("\n") - output_string += "\n FINISHED RUNNING #{@total_tests} TESTS WITH #{@total_fails} FAILURES" + output_string += "\nFINISHED RUNNING #{@test_count} TESTS WITH #{@fail_count} FAILURES" f.write output_string end end diff --git a/spec/xcpretty/reporters/reporter_spec.rb b/spec/xcpretty/reporters/reporter_spec.rb index 3d27bf27..3ccdb062 100644 --- a/spec/xcpretty/reporters/reporter_spec.rb +++ b/spec/xcpretty/reporters/reporter_spec.rb @@ -6,32 +6,35 @@ module XCPretty describe Reporter do + before(:each) do @reporter = Reporter.new(path: "example_file") end - end - it "reports a passing test" do - @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") - expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") - end + it "reports a passing test" do + @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") + expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") + end - it "reports a failing test" do - @reporter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file') - expect(@reporter.tests).to include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") - end + it "reports a failing test" do + @reporter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file') + expect(@reporter.tests).to include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") + end - it "reports a pending test" do - @reporter.format_pending_text("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object") - expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") - end + it "reports a pending test" do + @reporter.format_pending_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object") + expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") + end - it "writes to disk" do - @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") + it "writes to disk" do + @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") - File.stub(:write) - @reporter.write_report + file = double("file stub") + File.should_receive(:open).with("example_file", "w").and_yield(file) + file.should_receive(:write).with("_tupleByAddingObject__should_add_a_non_nil_object PASSED\nFINISHED RUNNING 1 TESTS WITH 0 FAILURES") + @reporter.write_report + + end - expect(File).to have_received(:write).with("example_file", "_tupleByAddingObject__should_add_a_non_nil_object PASSED\nFINISHED RUNNING 1 TESTS WITH 0 FAILURES") end end \ No newline at end of file From 5fe3254a99d1f7c4531f51dff8f0a374c25e63e1 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 11:41:59 -0800 Subject: [PATCH 05/61] Update all reporters to subclass reporter --- lib/xcpretty/reporters/html.rb | 13 ++---------- .../reporters/json_compilation_database.rb | 21 ++++--------------- lib/xcpretty/reporters/junit.rb | 10 +++------ lib/xcpretty/reporters/reporter.rb | 1 + 4 files changed, 10 insertions(+), 35 deletions(-) diff --git a/lib/xcpretty/reporters/html.rb b/lib/xcpretty/reporters/html.rb index d8abaabb..590842cf 100644 --- a/lib/xcpretty/reporters/html.rb +++ b/lib/xcpretty/reporters/html.rb @@ -1,7 +1,6 @@ module XCPretty - class HTML + class HTML < Reporter - include XCPretty::FormatMethods FILEPATH = 'build/reports/tests.html' TEMPLATE = File.expand_path('../../../../assets/report.html.erb', __FILE__) SCREENSHOT_DIR = 'build/reports' @@ -16,12 +15,9 @@ def load_dependencies end def initialize(options) + super(options) load_dependencies @test_suites = {} - @filepath = options[:path] || FILEPATH - @parser = Parser.new(self) - @test_count = 0 - @fail_count = 0 @collect_screenshots = options[:screenshots] end @@ -39,11 +35,6 @@ def format_passing_test(suite, test_case, time) add_test(suite, name: test_case, time: time) end - def finish - FileUtils.mkdir_p(File.dirname(@filepath)) - write_report - end - private def formatted_snippet(filepath) diff --git a/lib/xcpretty/reporters/json_compilation_database.rb b/lib/xcpretty/reporters/json_compilation_database.rb index 1a5f3bd7..85f92bf2 100644 --- a/lib/xcpretty/reporters/json_compilation_database.rb +++ b/lib/xcpretty/reporters/json_compilation_database.rb @@ -1,8 +1,7 @@ module XCPretty - class JSONCompilationDatabase + class JSONCompilationDatabase < Reporter - include XCPretty::FormatMethods - FILE_PATH = 'build/reports/compilation_db.json' + FILEPATH = 'build/reports/compilation_db.json' def load_dependencies unless @@loaded ||= false @@ -14,19 +13,14 @@ def load_dependencies end def initialize(options) + super(options) load_dependencies - @file_path = options[:path] || FILE_PATH - @parser = Parser.new(self) @compilation_units = [] @pch_path = nil @current_file = nil @current_path = nil end - def handle(line) - @parser.parse(line) - end - def format_process_pch_command(file_path) @pch_path = file_path end @@ -48,15 +42,8 @@ def format_compile_command(compiler_command, file_path) directory: directory} end - def finish - FileUtils.mkdir_p(File.dirname(@file_path)) - write_report - end - - private - def write_report - File.open(@file_path, 'w') do |f| + File.open(@filepath, 'w') do |f| f.write(@compilation_units.to_json) end end diff --git a/lib/xcpretty/reporters/junit.rb b/lib/xcpretty/reporters/junit.rb index 3136aef7..799f4fce 100644 --- a/lib/xcpretty/reporters/junit.rb +++ b/lib/xcpretty/reporters/junit.rb @@ -1,7 +1,6 @@ module XCPretty class JUnit - include XCPretty::FormatMethods FILEPATH = 'build/reports/junit.xml' def load_dependencies @@ -15,15 +14,12 @@ def load_dependencies end def initialize(options) + super(options) load_dependencies - @filepath = options[:path] || FILEPATH @directory = `pwd`.strip @document = REXML::Document.new @document << REXML::XMLDecl.new('1.0', 'UTF-8') @document.add_element('testsuites') - @parser = Parser.new(self) - @total_tests = 0 - @total_fails = 0 end def handle(line) @@ -61,12 +57,12 @@ def finish set_test_counters @document.root.attributes['tests'] = @total_tests @document.root.attributes['failures'] = @total_fails - write_report_file + write_report end private - def write_report_file + def write_report FileUtils.mkdir_p(File.dirname(@filepath)) formatter = REXML::Formatters::Pretty.new(2) formatter.compact = true diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index 024b41b6..b20cfe7b 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -1,6 +1,7 @@ module XCPretty class Reporter < Formatter + FILEPATH = 'build/reports/tests.txt' attr_reader :tests From 320e9dd7d9ca49a21e37e33119886a1927f081bb Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 12:15:43 -0800 Subject: [PATCH 06/61] Fix constant to override in subclasses. Add Reporter to feature env --- features/support/env.rb | 3 ++- lib/xcpretty/reporters/reporter.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/features/support/env.rb b/features/support/env.rb index cddf7c54..fcb37b94 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -8,6 +8,7 @@ require 'lib/xcpretty/syntax' require 'rexml/document' require 'lib/xcpretty/formatters/formatter' +require 'lib/xcpretty/reporters/reporter' require 'lib/xcpretty/reporters/junit' require 'lib/xcpretty/reporters/html' require 'lib/xcpretty/reporters/json_compilation_database' @@ -111,7 +112,7 @@ def copy_file_to_screenshot_dir(screenshot_file) @json = nil FileUtils.rm_rf(XCPretty::JUnit::FILEPATH) FileUtils.rm_rf(XCPretty::HTML::FILEPATH) - FileUtils.rm_rf(XCPretty::JSONCompilationDatabase::FILE_PATH) + FileUtils.rm_rf(XCPretty::JSONCompilationDatabase::FILEPATH) File.delete(@screenshot_file_path) if @screenshot_file_path end diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index b20cfe7b..95c08133 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -7,7 +7,7 @@ class Reporter < Formatter def initialize(options) super(true, true) - @filepath = options[:path] || FILEPATH + @filepath = options[:path] || self.class::FILEPATH @test_count = 0 @fail_count = 0 @tests = [] From 17b23f2d978f112ec9b6fc56ab03c258477376a0 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 12:33:23 -0800 Subject: [PATCH 07/61] Make junit subclass Reporter --- lib/xcpretty/reporters/junit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/reporters/junit.rb b/lib/xcpretty/reporters/junit.rb index 799f4fce..088e3f75 100644 --- a/lib/xcpretty/reporters/junit.rb +++ b/lib/xcpretty/reporters/junit.rb @@ -1,5 +1,5 @@ module XCPretty - class JUnit + class JUnit < Reporter FILEPATH = 'build/reports/junit.xml' From baded83802068861facad4e06dab4764f7b2f060 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 13:51:11 -0800 Subject: [PATCH 08/61] Formatting fixes --- lib/xcpretty/reporters/junit.rb | 9 ++-- lib/xcpretty/reporters/reporter.rb | 33 ++++++------ spec/xcpretty/reporters/reporter_spec.rb | 66 ++++++++++++------------ 3 files changed, 55 insertions(+), 53 deletions(-) diff --git a/lib/xcpretty/reporters/junit.rb b/lib/xcpretty/reporters/junit.rb index 088e3f75..3ea841bb 100644 --- a/lib/xcpretty/reporters/junit.rb +++ b/lib/xcpretty/reporters/junit.rb @@ -20,6 +20,8 @@ def initialize(options) @document = REXML::Document.new @document << REXML::XMLDecl.new('1.0', 'UTF-8') @document.add_element('testsuites') + @total_fails = 0 + @total_tests = 0 end def handle(line) @@ -57,13 +59,10 @@ def finish set_test_counters @document.root.attributes['tests'] = @total_tests @document.root.attributes['failures'] = @total_fails - write_report + super end - private - def write_report - FileUtils.mkdir_p(File.dirname(@filepath)) formatter = REXML::Formatters::Pretty.new(2) formatter.compact = true output_file = File.open(@filepath, 'w+') @@ -72,6 +71,8 @@ def write_report result end + private + def suite(classname) if @last_suite && @last_suite.attributes['name'] == classname return @last_suite diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index 95c08133..b255641f 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -1,28 +1,28 @@ module XCPretty - class Reporter < Formatter - FILEPATH = 'build/reports/tests.txt' + class Reporter < Formatter + FILEPATH = 'build/reports/tests.txt' - attr_reader :tests + attr_reader :tests - def initialize(options) - super(true, true) - @filepath = options[:path] || self.class::FILEPATH - @test_count = 0 - @fail_count = 0 - @tests = [] - end + def initialize(options) + super(true, true) + @filepath = options[:path] || self.class::FILEPATH + @test_count = 0 + @fail_count = 0 + @tests = [] + end - def handle(line) + def handle(line) @parser.parse(line) end - def finish + def finish FileUtils.mkdir_p(File.dirname(@filepath)) write_report end - def format_failing_test(suite, test_case, reason, file) + def format_failing_test(suite, test_case, reason, file) @test_count += 1 @fail_count += 1 @tests.push("#{test_case} in #{file} FAILED: #{reason}") @@ -36,7 +36,7 @@ def format_passing_test(suite, test_case, time) def format_pending_test(classname, test_case) @test_count += 1 @tests.push("#{test_case} IS PENDING") - end + end def write_report File.open(@filepath, 'w') do |f| @@ -47,6 +47,7 @@ def write_report end end - end + end + +end -end \ No newline at end of file diff --git a/spec/xcpretty/reporters/reporter_spec.rb b/spec/xcpretty/reporters/reporter_spec.rb index 3ccdb062..c007f31e 100644 --- a/spec/xcpretty/reporters/reporter_spec.rb +++ b/spec/xcpretty/reporters/reporter_spec.rb @@ -5,36 +5,36 @@ module XCPretty - describe Reporter do - - before(:each) do - @reporter = Reporter.new(path: "example_file") - end - - it "reports a passing test" do - @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") - expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") - end - - it "reports a failing test" do - @reporter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file') - expect(@reporter.tests).to include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") - end - - it "reports a pending test" do - @reporter.format_pending_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object") - expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") - end - - it "writes to disk" do - @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") - - file = double("file stub") - File.should_receive(:open).with("example_file", "w").and_yield(file) - file.should_receive(:write).with("_tupleByAddingObject__should_add_a_non_nil_object PASSED\nFINISHED RUNNING 1 TESTS WITH 0 FAILURES") - @reporter.write_report - - end - - end -end \ No newline at end of file + describe Reporter do + + before(:each) do + @reporter = Reporter.new(path: "example_file") + end + + it "reports a passing test" do + @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") + expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") + end + + it "reports a failing test" do + @reporter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file') + expect(@reporter.tests).to include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") + end + + it "reports a pending test" do + @reporter.format_pending_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object") + expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") + end + + it "writes to disk" do + @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") + file = double("file stub") + File.should_receive(:open).with("example_file", "w").and_yield(file) + file.should_receive(:write).with("_tupleByAddingObject__should_add_a_non_nil_object PASSED\nFINISHED RUNNING 1 TESTS WITH 0 FAILURES") + @reporter.write_report + + end + + end +end + From 4c572cbeeaeb406473140df09310973eccdce31a Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 14:38:56 -0800 Subject: [PATCH 09/61] Finish integrating custom reporters and related tests --- bin/xcpretty | 10 +++++++--- features/steps/report_steps.rb | 5 +++++ features/support/env.rb | 5 +++++ lib/xcpretty.rb | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/xcpretty b/bin/xcpretty index 4a2db92b..b70febb4 100755 --- a/bin/xcpretty +++ b/bin/xcpretty @@ -39,7 +39,7 @@ OptionParser.new do |opts| printer_opts[:formatter] = XCPretty::TestAnything end opts.on('-f', '--formatter PATH', 'Use formatter returned from evaluating the specified Ruby file') do |path| - printer_opts[:formatter] = XCPretty.load_custom_formatter(path) + printer_opts[:formatter] = XCPretty.load_custom_class(path) end opts.on('--[no-]color', 'Use colorized output. Defaults is auto') do |value| printer_opts[:colorize] = value @@ -47,9 +47,13 @@ OptionParser.new do |opts| opts.on('--[no-]utf', 'Use unicode characters in output. Default is auto.') do |value| printer_opts[:unicode] = value end - opts.on("-r", "--report FORMAT", "Run FORMAT reporter", + opts.on("-r", "--report FORMAT or PATH", "Run FORMAT or PATH reporter", " Choices: #{report_formats.keys.join(', ')}") do |format| - report_classes << report_formats[format] + if report_formats.key?(format) + report_classes << report_formats[format] + else + report_classes << XCPretty.load_custom_class(format) + end report_options << {} end opts.on('-o', '--output PATH', 'Write report output to PATH') do |path| diff --git a/features/steps/report_steps.rb b/features/steps/report_steps.rb index 13662b99..a9995262 100644 --- a/features/steps/report_steps.rb +++ b/features/steps/report_steps.rb @@ -20,3 +20,8 @@ step("I should have a test report at \"#{custom_report_path}\"") end +When(/^I pipe to xcpretty with a custom reporter$/) do + reporter_path = File.expand_path('../../../spec/fixtures/custom_reporter.rb', __FILE__) + run_xcpretty("-r #{reporter_path}") +end + diff --git a/features/support/env.rb b/features/support/env.rb index fcb37b94..a3feaf15 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -80,6 +80,10 @@ def junit_report_root junit_report.root.elements.to_a.first end +def custom_report + @custom_report ||= File.open(XCPretty::Reporter::FILEPATH, 'r').read +end + def custom_report_path @custom_report_path ||= begin @custom_report_file1 = Tempfile.new('custom_report_path') @@ -113,6 +117,7 @@ def copy_file_to_screenshot_dir(screenshot_file) FileUtils.rm_rf(XCPretty::JUnit::FILEPATH) FileUtils.rm_rf(XCPretty::HTML::FILEPATH) FileUtils.rm_rf(XCPretty::JSONCompilationDatabase::FILEPATH) + FileUtils.rm_rf(XCPretty::Reporter::FILEPATH) File.delete(@screenshot_file_path) if @screenshot_file_path end diff --git a/lib/xcpretty.rb b/lib/xcpretty.rb index f05b1991..70b4edcd 100644 --- a/lib/xcpretty.rb +++ b/lib/xcpretty.rb @@ -22,11 +22,11 @@ def self.class_from_path(path) klass end - def self.load_custom_formatter(path) + def self.load_custom_class(path) $LOAD_PATH.unshift File.dirname(path) class_from_path(path) rescue SyntaxError => e - exit_with_error("Expected formatter source file to return a class. #{e}") + exit_with_error("Expected custom source file to return a class. #{e}") end def self.exit_with_error(message) From 9f7e088ab16b0bcd0e8e1f0a146f020b005ba2a1 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 15:30:15 -0800 Subject: [PATCH 10/61] Add custom reporter files for test --- features/custom_reporter.feature | 29 ++++++++++++++++++++++ features/steps/custom_reporter_steps.rb | 16 +++++++++++++ spec/fixtures/custom_reporter.rb | 32 +++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 features/custom_reporter.feature create mode 100644 features/steps/custom_reporter_steps.rb create mode 100644 spec/fixtures/custom_reporter.rb diff --git a/features/custom_reporter.feature b/features/custom_reporter.feature new file mode 100644 index 00000000..16d13107 --- /dev/null +++ b/features/custom_reporter.feature @@ -0,0 +1,29 @@ +Feature: Loading an arbitrary Ruby file as a reporter + + Background: + Given the tests have started running + + Scenario: The file loaded does not contain a Ruby class + When I pipe to xcpretty with "-r /bin/bash" + Then the exit status code should be 1 + + Scenario: The file loaded contains a Ruby class + Given I have a file to compile + When I pipe to xcpretty with a custom reporter + Then the exit status code should be 0 + + Scenario: Showing failed tests + Given I have a failing test in my suite + When I pipe to xcpretty with a custom reporter + Then I should see a failed test in my custom report + And the custom failure counter should show 1 test + + Scenario: Showing passing tests + Given I have a passing test in my suite + When I pipe to xcpretty with a custom reporter + Then I should see a passing test in my custom report + + Scenario: Showing pending tests + Given I have a pending test in my suite + When I pipe to xcpretty with a custom reporter + Then I should see a pending test in my custom report \ No newline at end of file diff --git a/features/steps/custom_reporter_steps.rb b/features/steps/custom_reporter_steps.rb new file mode 100644 index 00000000..2348e2c4 --- /dev/null +++ b/features/steps/custom_reporter_steps.rb @@ -0,0 +1,16 @@ +Then(/^I should see a passing test in my custom report$/) do + custom_report.should include("WOW such PASS.") +end + +Then(/^I should see a failed test in my custom report$/) do + custom_report.should include("WOW such FAIL.") +end + +Then(/^I should see a pending test in my custom report$/) do + custom_report.should include("WOW such PENDING.") +end + +Then(/^the custom failure counter should show (\d+) tests?$/) do |fail_count| + custom_report.should include("Much 1 FAIL.") +end + diff --git a/spec/fixtures/custom_reporter.rb b/spec/fixtures/custom_reporter.rb new file mode 100644 index 00000000..7a796e4c --- /dev/null +++ b/spec/fixtures/custom_reporter.rb @@ -0,0 +1,32 @@ +# encoding: utf-8 +require 'FileUtils' + +class DogeReporter < XCPretty::Reporter + + def format_failing_test(suite, test_case, reason, file) + @test_count += 1 + @fail_count += 1 + @tests.push("WOW such FAIL. Many #{test_case}. Much #{reason}. Very #{file}.") + end + + def format_passing_test(suite, test_case, time) + @test_count += 1 + @tests.push("WOW such PASS. Many #{test_case}. Much green. Very success.") + end + + def format_pending_test(classname, test_case) + @test_count += 1 + @tests.push("WOW such PENDING. Many #{test_case}. Much stop. Very wait.") + end + + def write_report + File.open(@filepath, 'w') do |f| + output_string = @tests.join("\n") + output_string += "\nWOW such FINISH. Very #{@test_count}. Much #{@fail_count} FAIL. Very done." + f.write output_string + end + end +end + +DogeReporter + From 4ec0d4d10569ba9e9cfb886b61ead56c282543b9 Mon Sep 17 00:00:00 2001 From: "Titolo, Michele" Date: Tue, 22 Dec 2015 15:37:23 -0800 Subject: [PATCH 11/61] Add load_dependencies method to reporter so fileutils is always loaded --- lib/xcpretty/reporters/html.rb | 1 - lib/xcpretty/reporters/json_compilation_database.rb | 1 - lib/xcpretty/reporters/junit.rb | 1 - lib/xcpretty/reporters/reporter.rb | 8 ++++++++ spec/fixtures/custom_reporter.rb | 2 -- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/xcpretty/reporters/html.rb b/lib/xcpretty/reporters/html.rb index 590842cf..e6509117 100644 --- a/lib/xcpretty/reporters/html.rb +++ b/lib/xcpretty/reporters/html.rb @@ -16,7 +16,6 @@ def load_dependencies def initialize(options) super(options) - load_dependencies @test_suites = {} @collect_screenshots = options[:screenshots] end diff --git a/lib/xcpretty/reporters/json_compilation_database.rb b/lib/xcpretty/reporters/json_compilation_database.rb index 85f92bf2..60527971 100644 --- a/lib/xcpretty/reporters/json_compilation_database.rb +++ b/lib/xcpretty/reporters/json_compilation_database.rb @@ -14,7 +14,6 @@ def load_dependencies def initialize(options) super(options) - load_dependencies @compilation_units = [] @pch_path = nil @current_file = nil diff --git a/lib/xcpretty/reporters/junit.rb b/lib/xcpretty/reporters/junit.rb index 3ea841bb..6f50fa81 100644 --- a/lib/xcpretty/reporters/junit.rb +++ b/lib/xcpretty/reporters/junit.rb @@ -15,7 +15,6 @@ def load_dependencies def initialize(options) super(options) - load_dependencies @directory = `pwd`.strip @document = REXML::Document.new @document << REXML::XMLDecl.new('1.0', 'UTF-8') diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index b255641f..b9112c33 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -5,8 +5,16 @@ class Reporter < Formatter attr_reader :tests + def load_dependencies + unless @@loaded ||= false + require 'fileutils' + @@loaded = true + end + end + def initialize(options) super(true, true) + load_dependencies @filepath = options[:path] || self.class::FILEPATH @test_count = 0 @fail_count = 0 diff --git a/spec/fixtures/custom_reporter.rb b/spec/fixtures/custom_reporter.rb index 7a796e4c..f16d4477 100644 --- a/spec/fixtures/custom_reporter.rb +++ b/spec/fixtures/custom_reporter.rb @@ -1,6 +1,4 @@ # encoding: utf-8 -require 'FileUtils' - class DogeReporter < XCPretty::Reporter def format_failing_test(suite, test_case, reason, file) From 9152400193e12d430c58c2afe67c4ad0cb7355a0 Mon Sep 17 00:00:00 2001 From: Dan Fleming Date: Mon, 25 Jan 2016 18:35:26 -0500 Subject: [PATCH 12/61] Support aggregate targets --- lib/xcpretty/formatters/formatter.rb | 1 + lib/xcpretty/formatters/simple.rb | 4 ++++ lib/xcpretty/parser.rb | 8 ++++++++ spec/fixtures/constants.rb | 1 + spec/xcpretty/formatters/simple_spec.rb | 5 +++++ spec/xcpretty/parser_spec.rb | 5 +++++ 6 files changed, 24 insertions(+) diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index 48be608e..8993382a 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -11,6 +11,7 @@ module FormatMethods def format_analyze(file_name, file_path); EMPTY; end def format_build_target(target, project, configuration); EMPTY; end + def format_aggregate_target(target, project, configuration); EMPTY; end def format_analyze_target(target, project, configuration); EMPTY; end def format_check_dependencies; EMPTY; end def format_clean(project, target, configuration); EMPTY; end diff --git a/lib/xcpretty/formatters/simple.rb b/lib/xcpretty/formatters/simple.rb index 65128da9..2cd812de 100644 --- a/lib/xcpretty/formatters/simple.rb +++ b/lib/xcpretty/formatters/simple.rb @@ -27,6 +27,10 @@ def format_build_target(target, project, configuration) format("Building", "#{project}/#{target} [#{configuration}]") end + def format_aggregate_target(target, project, configuration) + format("Aggregate", "#{project}/#{target} [#{configuration}]") + end + def format_analyze_target(target, project, configuration) format("Analyzing", "#{project}/#{target} [#{configuration}]") end diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index a2c31c70..b9873208 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -15,6 +15,12 @@ module Matchers # $3 configuration BUILD_TARGET_MATCHER = /^=== BUILD TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/ + # @regex Captured groups + # $1 target + # $2 project + # $3 configuration + AGGREGATE_TARGET_MATCHER = /^=== BUILD AGGREGATE TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/ + # @regex Captured groups # $1 target # $2 project @@ -281,6 +287,8 @@ def parse(text) formatter.format_analyze($2, $1) when BUILD_TARGET_MATCHER formatter.format_build_target($1, $2, $3) + when AGGREGATE_TARGET_MATCHER + formatter.format_aggregate_target($1, $2, $3) when ANALYZE_TARGET_MATCHER formatter.format_analyze_target($1, $2, $3) when CLEAN_REMOVE_MATCHER diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index e2c24e52..446e92ae 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -23,6 +23,7 @@ SAMPLE_BUILD = "=== BUILD TARGET The Spacer OF PROJECT Pods WITH THE DEFAULT CONFIGURATION Debug ===" SAMPLE_ANALYZE_TARGET = "=== ANALYZE TARGET The Spacer OF PROJECT Pods WITH THE DEFAULT CONFIGURATION Debug ===" +SAMPLE_AGGREGATE_TARGET = "=== BUILD AGGREGATE TARGET Be Aggro OF PROJECT AggregateExample WITH CONFIGURATION Debug ===" SAMPLE_CLEAN = "=== CLEAN TARGET Pods-ObjectiveSugar OF PROJECT Pods WITH CONFIGURATION Debug ===" SAMPLE_ANOTHER_CLEAN = "=== CLEAN TARGET Pods OF PROJECT Pods WITH CONFIGURATION Debug ===" SAMPLE_BUILD_SUCCEEDED = "** BUILD SUCCEEDED **" diff --git a/spec/xcpretty/formatters/simple_spec.rb b/spec/xcpretty/formatters/simple_spec.rb index edc8a284..bc90cc28 100644 --- a/spec/xcpretty/formatters/simple_spec.rb +++ b/spec/xcpretty/formatters/simple_spec.rb @@ -20,6 +20,11 @@ module XCPretty "> Building Pods/The Spacer [Debug]" end + it "formats build target/project/configuration with target" do + @formatter.format_aggregate_target("Be Aggro", "AggregateExample", "Debug").should == + "> Aggregate AggregateExample/Be Aggro [Debug]" + end + it "formats analyze target/project/configuration with target" do @formatter.format_analyze_target("The Spacer", "Pods", "Debug").should == "> Analyzing Pods/The Spacer [Debug]" diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 614a91cd..8517ff31 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -28,6 +28,11 @@ module XCPretty @parser.parse(SAMPLE_BUILD) end + it "parses aggregate target" do + @formatter.should receive(:format_aggregate_target).with("Be Aggro", "AggregateExample", "Debug") + @parser.parse(SAMPLE_AGGREGATE_TARGET) + end + it "parses analyze target" do @formatter.should receive(:format_analyze_target).with("The Spacer", "Pods", "Debug") @parser.parse(SAMPLE_ANALYZE_TARGET) From b2769879091d45275ccf4940fe9eb38213dc05ef Mon Sep 17 00:00:00 2001 From: Dan Fleming Date: Mon, 25 Jan 2016 22:21:54 -0500 Subject: [PATCH 13/61] Fix rubocop warnings --- Rakefile | 1 + features/steps/json_steps.rb | 1 + spec/xcpretty/reporters/junit_spec.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/Rakefile b/Rakefile index 7400b0e8..560a561f 100644 --- a/Rakefile +++ b/Rakefile @@ -23,3 +23,4 @@ task :ci do Rake::Task[:cucumber].invoke Rake::Task[:lint].invoke end + diff --git a/features/steps/json_steps.rb b/features/steps/json_steps.rb index 0f98573c..85b0e130 100644 --- a/features/steps/json_steps.rb +++ b/features/steps/json_steps.rb @@ -39,3 +39,4 @@ entries = json_db.select { |entry| entry['command'].match(/-include\s+-/) } entries.length.should == 0 end + diff --git a/spec/xcpretty/reporters/junit_spec.rb b/spec/xcpretty/reporters/junit_spec.rb index cce3e905..1fe9f64c 100644 --- a/spec/xcpretty/reporters/junit_spec.rb +++ b/spec/xcpretty/reporters/junit_spec.rb @@ -17,3 +17,4 @@ module XCPretty end end end + From 8d661d409c6d5431170da4f799b573f5ed6ee239 Mon Sep 17 00:00:00 2001 From: Dan Fleming Date: Mon, 25 Jan 2016 22:27:05 -0500 Subject: [PATCH 14/61] Add features for Build/Aggregate/Analyze targets --- features/simple_format.feature | 15 +++++++++++++++ features/steps/formatting_steps.rb | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/features/simple_format.feature b/features/simple_format.feature index ddd14bea..b70c99e1 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -45,6 +45,21 @@ Feature: Showing build output in simple format When I pipe to xcpretty with "--simple --color" Then I should see a yellow completion icon + Scenario: Showing build target + Given I have a target to build + When I pipe to xcpretty with "--simple --no-color" + Then I should see a build target message + + Scenario: Showing aggregate target + Given I have an aggregate target to build + When I pipe to xcpretty with "--simple --no-color" + Then I should see an aggregate target message + + Scenario: Showing analyze target + Given I have a target to analyze + When I pipe to xcpretty with "--simple --no-color" + Then I should see an analyze target message + Scenario: Showing analyze Given I have a file to analyze When I pipe to xcpretty with "--simple --no-color" diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index e273dc7e..e432e262 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -15,6 +15,18 @@ add_run_input SAMPLE_PRECOMPILE end +Given(/^I have a target to build$/) do + add_run_input SAMPLE_BUILD +end + +Given(/^I have an aggregate target to build$/) do + add_run_input SAMPLE_AGGREGATE_TARGET +end + +Given(/^I have a target to analyze$/) do + add_run_input SAMPLE_ANALYZE_TARGET +end + Given(/^I have a file to analyze$/) do add_run_input SAMPLE_ANALYZE end @@ -169,6 +181,18 @@ run_output.should start_with("▸ Precompiling") end +Then(/^I should see a build target message$/) do + run_output.should start_with("▸ Building") +end + +Then(/^I should see an aggregate target message$/) do + run_output.should start_with("▸ Aggregate") +end + +Then(/^I should see an analyze target message$/) do + run_output.should start_with("▸ Analyzing") +end + Then(/^I should see a successful analyze message$/) do run_output.should start_with("▸ Analyzing") end From d706e6b2897fba65b50a747941430f1a7f6593b3 Mon Sep 17 00:00:00 2001 From: Dan Fleming Date: Tue, 26 Jan 2016 09:49:34 -0500 Subject: [PATCH 15/61] omit unnecessary tests --- features/simple_format.feature | 10 ---------- features/steps/formatting_steps.rb | 16 ---------------- 2 files changed, 26 deletions(-) diff --git a/features/simple_format.feature b/features/simple_format.feature index b70c99e1..d082570e 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -45,21 +45,11 @@ Feature: Showing build output in simple format When I pipe to xcpretty with "--simple --color" Then I should see a yellow completion icon - Scenario: Showing build target - Given I have a target to build - When I pipe to xcpretty with "--simple --no-color" - Then I should see a build target message - Scenario: Showing aggregate target Given I have an aggregate target to build When I pipe to xcpretty with "--simple --no-color" Then I should see an aggregate target message - Scenario: Showing analyze target - Given I have a target to analyze - When I pipe to xcpretty with "--simple --no-color" - Then I should see an analyze target message - Scenario: Showing analyze Given I have a file to analyze When I pipe to xcpretty with "--simple --no-color" diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index e432e262..45cbb6d6 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -15,18 +15,10 @@ add_run_input SAMPLE_PRECOMPILE end -Given(/^I have a target to build$/) do - add_run_input SAMPLE_BUILD -end - Given(/^I have an aggregate target to build$/) do add_run_input SAMPLE_AGGREGATE_TARGET end -Given(/^I have a target to analyze$/) do - add_run_input SAMPLE_ANALYZE_TARGET -end - Given(/^I have a file to analyze$/) do add_run_input SAMPLE_ANALYZE end @@ -181,18 +173,10 @@ run_output.should start_with("▸ Precompiling") end -Then(/^I should see a build target message$/) do - run_output.should start_with("▸ Building") -end - Then(/^I should see an aggregate target message$/) do run_output.should start_with("▸ Aggregate") end -Then(/^I should see an analyze target message$/) do - run_output.should start_with("▸ Analyzing") -end - Then(/^I should see a successful analyze message$/) do run_output.should start_with("▸ Analyzing") end From 4ad2c4ed0e8c1d001e368c3708c466cb0e3b8ba9 Mon Sep 17 00:00:00 2001 From: Philippe Bernery Date: Mon, 1 Feb 2016 09:38:00 +0100 Subject: [PATCH 16/61] Add the JUnit time attribute on a failed tests. The Sonar JUnit parser fails if the time attribute is not present on failed tests. This patch adds the time attribute for these tests with a fixed duration of "0". Adding the real test duration was considered however it cannot be done easily with the current xcpretty implementation: xcpretty parses Xcode output line by line whereas a failed test outputs at least 2 lines of log: one that shows the failed test and the cause, another that displays the duration (quite the same line as a passing test). A considered approach would be to keep a context and output a transformed log line only if the context is full (in the case of failed tests, only if the cause and the duration have been parsed). --- features/steps/junit_steps.rb | 2 +- lib/xcpretty/reporters/junit.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/features/steps/junit_steps.rb b/features/steps/junit_steps.rb index ec1970d0..1e79753c 100644 --- a/features/steps/junit_steps.rb +++ b/features/steps/junit_steps.rb @@ -1,7 +1,7 @@ Then(/^I should see a failed test node in my report$/) do junit_report_root.elements.to_a.detect do |node| element = node.elements.to_a.first - element && element.name == "failure" + element && element.name == "failure" && node.attributes["time"] != nil end.should_not be_nil end diff --git a/lib/xcpretty/reporters/junit.rb b/lib/xcpretty/reporters/junit.rb index ef3925fe..8ec7448d 100644 --- a/lib/xcpretty/reporters/junit.rb +++ b/lib/xcpretty/reporters/junit.rb @@ -54,6 +54,8 @@ def format_failing_test(classname, test_case, reason, file) test_node = suite(classname).add_element('testcase') test_node.attributes['classname'] = classname test_node.attributes['name'] = test_case + # A fake time is added to let Sonar parse failed tests. + test_node.attributes['time'] = "0" fail_node = test_node.add_element('failure') fail_node.attributes['message'] = reason fail_node.text = file.sub(@directory + '/', '') From b07769ba4cc8a1b1370c1dc28ecbfde7d6358b20 Mon Sep 17 00:00:00 2001 From: Jared Grubb Date: Sun, 10 Apr 2016 20:23:10 -0700 Subject: [PATCH 17/61] README: Fix the path of the json compilation database --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8fd9729a..24512930 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ $ xcodebuild [flags] | tee xcodebuild.log | xcpretty - `--report html`, `-r html`: Creates a simple HTML report at `build/reports/tests.html`. ![xcpretty html](http://i.imgur.com/0Rnux3v.gif) -- `--report json-compilation-database`, `-r json-compilation-database`: Creates a [JSON compilation database](http://clang.llvm.org/docs/JSONCompilationDatabase.html) at `build/reports/compilation.json`. This is a format to replay single compilations independently of the build system. +- `--report json-compilation-database`, `-r json-compilation-database`: Creates a [JSON compilation database](http://clang.llvm.org/docs/JSONCompilationDatabase.html) at `build/reports/compilation_db.json`. This is a format to replay single compilations independently of the build system. Writing a report to a custom path can be specified using `--output PATH`. From 1788a3d0c1eff5b5f4261ef2f63b02a9994a090a Mon Sep 17 00:00:00 2001 From: Christian Sampaio Date: Tue, 3 May 2016 23:38:07 +0200 Subject: [PATCH 18/61] Simple typo (#218) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24512930..6680db24 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Writing a report to a custom path can be specified using `--output PATH`. `xcpretty` supports custom formatters through the use of the `--formatter` flag, which takes a path to a file as an argument. The file must contain a Ruby subclass of `XCPretty::Formatter`, and -return that class at the end of te file. The class +return that class at the end of the file. The class can override the `format_*` methods to hook into output parsing events. From caa05df6bf3ea7b217a7c680bb0d063e0066f1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Gro=C3=9F?= Date: Sun, 15 May 2016 13:36:18 +0200 Subject: [PATCH 19/61] Add support for custom compiler toolchains Projects may decide to use their own compiler toolchain for building, in which case the path to the clang executable will likely not contain the /usr prefix. This commit thus removes that prefix from the corresponding matcher. --- lib/xcpretty/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index b9873208..5825acff 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -60,7 +60,7 @@ module Matchers # @regex Captured groups # $1 compiler_command # $2 file_path - COMPILE_COMMAND_MATCHER = /^\s*(.*\/usr\/bin\/clang\s.*\s\-c\s(.*\.(?:m|mm|c|cc|cpp|cxx))\s.*\.o)$/ + COMPILE_COMMAND_MATCHER = /^\s*(.*\/bin\/clang\s.*\s\-c\s(.*\.(?:m|mm|c|cc|cpp|cxx))\s.*\.o)$/ # @regex Captured groups # $1 file_path From 19f2f46291183aedbb33b10cbf4206b22d2308d9 Mon Sep 17 00:00:00 2001 From: Jared Grubb Date: Sun, 13 Dec 2015 14:40:41 -0800 Subject: [PATCH 20/61] Analyzer: match other extensions than just .m --- lib/xcpretty/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index b9873208..723e862b 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -7,7 +7,7 @@ module Matchers # @regex Captured groups # $1 file_path # $2 file_name - ANALYZE_MATCHER = /^Analyze(?:Shallow)?\s(.*\/(.*\.m))*/ + ANALYZE_MATCHER = /^Analyze(?:Shallow)?\s(.*\/(.*\.(?:m|mm|cc|cpp|c|cxx)))\s*/ # @regex Captured groups # $1 target From 87926fc68577f36c42892f95d1ef98e293b53d87 Mon Sep 17 00:00:00 2001 From: Jared Grubb Date: Sun, 13 Dec 2015 14:40:55 -0800 Subject: [PATCH 21/61] Ld matcher: match relative paths too --- lib/xcpretty/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 723e862b..b97442e6 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -112,7 +112,7 @@ module Matchers # $1 = target # $2 = build_variants (normal, profile, debug) # $3 = architecture - LINKING_MATCHER = /^Ld \/.*\/(.*) (.*) (.*)$/ + LINKING_MATCHER = /^Ld (.*) (.*) (.*)$/ # @regex Captured groups # $1 = suite From 35dedec095e4a5201952309014702ceb70b430a8 Mon Sep 17 00:00:00 2001 From: Jared Grubb Date: Sun, 15 May 2016 13:43:14 -0700 Subject: [PATCH 22/61] Fix up unit test and add tests for the new features --- lib/xcpretty/parser.rb | 2 +- spec/fixtures/constants.rb | 13 +++++++++++++ spec/xcpretty/parser_spec.rb | 10 ++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index b97442e6..c5f33b53 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -112,7 +112,7 @@ module Matchers # $1 = target # $2 = build_variants (normal, profile, debug) # $3 = architecture - LINKING_MATCHER = /^Ld (.*) (.*) (.*)$/ + LINKING_MATCHER = /^Ld \/?.*\/(.*?) (.*) (.*)$/ # @regex Captured groups # $1 = suite diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index 446e92ae..1a70d3b3 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -105,6 +105,13 @@ setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/musalj/code/go/bin:/Users/musalj/.rbenv/shims:/Users/musalj/.rbenv/bin:/usr/local/share/npm/bin:/usr/local/bin:/Library/Python/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator -F/Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator -filelist /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugar.build/Objects-normal/i386/ObjectiveSugar.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.3 -framework UIKit -framework Foundation -framework CoreGraphics -lPods -Xlinker -dependency_info -Xlinker /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugar.build/Objects-normal/i386/ObjectiveSugar_dependency_info.dat -o /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator/ObjectiveSugar.app/ObjectiveSugar ) +SAMPLE_LD_RELATIVE = %Q( +Ld ../Build/Products/Debug-iphonesimulator/ObjectiveSugar.app/ObjectiveSugar normal i386 + cd /Users/musalj/code/OSS/ObjectiveSugar/Example + setenv IPHONEOS_DEPLOYMENT_TARGET 4.3 + setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/musalj/code/go/bin:/Users/musalj/.rbenv/shims:/Users/musalj/.rbenv/bin:/usr/local/share/npm/bin:/usr/local/bin:/Library/Python/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator -F/Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator -filelist /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugar.build/Objects-normal/i386/ObjectiveSugar.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.3 -framework UIKit -framework Foundation -framework CoreGraphics -lPods -Xlinker -dependency_info -Xlinker /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugar.build/Objects-normal/i386/ObjectiveSugar_dependency_info.dat -o /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator/ObjectiveSugar.app/ObjectiveSugar +).freeze SAMPLE_DSYM = %Q( GenerateDSYMFile /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator/ObjectiveSugarTests.octest.dSYM /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator/ObjectiveSugarTests.octest/ObjectiveSugarTests cd /Users/musalj/code/OSS/ObjectiveSugar/Example @@ -474,6 +481,12 @@ setenv LANG en_US.US-ASCII /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=107 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Werror -Wmissing-field-initializers -Wmissing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -Wno-selector -Wstrict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.7 -g -fvisibility=hidden -Wno-sign-conversion -D__clang_analyzer__ -Xclang -analyzer-output=plist-multi-file -Xclang -analyzer-config -Xclang path-diagnostics-alternate=true -Xclang -analyzer-config -Xclang report-in-main-source-file=true -Xclang -analyzer-config -Xclang mode=shallow -Xclang -analyzer-checker -Xclang security.insecureAPI.UncheckedReturn -Xclang -analyzer-checker -Xclang security.insecureAPI.getpw -Xclang -analyzer-checker -Xclang security.insecureAPI.gets -Xclang -analyzer-checker -Xclang security.insecureAPI.mkstemp -Xclang -analyzer-checker -Xclang security.insecureAPI.mktemp -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.rand -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.strcpy -Xclang -analyzer-checker -Xclang security.insecureAPI.vfork -iquote /Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-generated-files.hmap -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-own-target-headers.hmap -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-all-target-headers.hmap -iquote /Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-project-headers.hmap -I/Users/dustin/Source/CocoaChip/build/Release/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/DerivedSources/x86_64 -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/DerivedSources -F/Users/dustin/Source/CocoaChip/build/Release -include /var/folders/nn/s88k060x7016ccml2bc6f5_h0000gn/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/SharedPrecompiledHeaders/CocoaChip-Prefix-dzmrdzscqkbvvrafvxsbjwbxtmlz/CocoaChip-Prefix.pch --analyze /Users/dustin/Source/CocoaChip/CocoaChip/CCChip8DisplayView.m -o /Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/StaticAnalyzer/CocoaChip/CocoaChip/normal/x86_64/CCChip8DisplayView.plist ) +SAMPLE_ANALYZE_CPP = %Q( +Analyze CocoaChip/CCChip8DisplayView.cpp + cd /Users/dustin/Source/CocoaChip + setenv LANG en_US.US-ASCII + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=107 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Werror -Wmissing-field-initializers -Wmissing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -Wno-selector -Wstrict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.7 -g -fvisibility=hidden -Wno-sign-conversion -D__clang_analyzer__ -Xclang -analyzer-output=plist-multi-file -Xclang -analyzer-config -Xclang path-diagnostics-alternate=true -Xclang -analyzer-config -Xclang report-in-main-source-file=true -Xclang -analyzer-checker -Xclang security.insecureAPI.UncheckedReturn -Xclang -analyzer-checker -Xclang security.insecureAPI.getpw -Xclang -analyzer-checker -Xclang security.insecureAPI.gets -Xclang -analyzer-checker -Xclang security.insecureAPI.mkstemp -Xclang -analyzer-checker -Xclang security.insecureAPI.mktemp -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.rand -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.strcpy -Xclang -analyzer-checker -Xclang security.insecureAPI.vfork -iquote /Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-generated-files.hmap -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-own-target-headers.hmap -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-all-target-headers.hmap -iquote /Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/CocoaChip-project-headers.hmap -I/Users/dustin/Source/CocoaChip/build/Release/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/DerivedSources/x86_64 -I/Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/DerivedSources -F/Users/dustin/Source/CocoaChip/build/Release -include /var/folders/nn/s88k060x7016ccml2bc6f5_h0000gn/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/SharedPrecompiledHeaders/CocoaChip-Prefix-cqqikmscxiepjgdcrgpysqicucyu/CocoaChip-Prefix.pch --analyze /Users/dustin/Source/CocoaChip/CocoaChip/CCChip8DisplayView.m -o /Users/dustin/Source/CocoaChip/build/CocoaChip.build/Release/CocoaChip.build/StaticAnalyzer/CocoaChip/CocoaChip/normal/x86_64/CCChip8DisplayView.plist +).freeze SAMPLE_COMPILE_XIB = %Q( CompileXIB CocoaChip/en.lproj/MainMenu.xib cd /Users/dustin/Source/CocoaChip diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 8517ff31..0bca3e35 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -23,6 +23,11 @@ module XCPretty @parser.parse(SAMPLE_ANALYZE_SHALLOW) end + it "parses analyze for a C++ target" do + @formatter.should receive(:format_analyze).with("CCChip8DisplayView.cpp", "CocoaChip/CCChip8DisplayView.cpp") + @parser.parse(SAMPLE_ANALYZE_CPP) + end + it "parses build target" do @formatter.should receive(:format_build_target).with("The Spacer", "Pods", "Debug") @parser.parse(SAMPLE_BUILD) @@ -153,6 +158,11 @@ module XCPretty @parser.parse(SAMPLE_LD) end + it "parses Ld with relative path" do + @formatter.should receive(:format_linking).with('ObjectiveSugar', 'normal', 'i386') + @parser.parse(SAMPLE_LD_RELATIVE) + end + it "parses Libtool" do @formatter.should receive(:format_libtool).with('libPods-ObjectiveSugarTests-Kiwi.a') @parser.parse(SAMPLE_LIBTOOL) From 70a7bf34c16c0de6b53ca71ca6d632c567b7a186 Mon Sep 17 00:00:00 2001 From: rasharab Date: Wed, 22 Jun 2016 14:15:15 -0700 Subject: [PATCH 23/61] Fix bug whereby syntax highlighting was being performed in non-colorize mode (#182) Was producing cruft of bad output for our console logs on our build machines. --- lib/xcpretty/formatters/formatter.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index 696a142b..dd84380f 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -162,10 +162,19 @@ def format_failures(failures_per_suite) end def format_failure(f) - " #{f[:test_case]}, #{red(f[:reason])}\n #{cyan(f[:file_path])}\n" \ - " ```\n" + - Syntax.highlight(Snippet.from_filepath(f[:file_path])) + - " ```" + snippet = Snippet.from_filepath(f[:file_path]) + + output = " #{f[:test_case]}, #{red(f[:reason])}\n " \ + "#{cyan(f[:file_path])}\n ```\n" + + if @colorize + output += Syntax.highlight(snippet) + else + output += snippet.contents + end + + output += " ```" + output end def error_symbol From 62bbd4ef98241817f3da2361dd07957079dca1ee Mon Sep 17 00:00:00 2001 From: andybest Date: Mon, 18 Jul 2016 20:36:16 +0100 Subject: [PATCH 24/61] Fixed issue where the wrong syntax formatter was being used for HTML (#224) * Fixed issue where the wrong syntax formatter was being used for HTML * Removed redundant self --- lib/xcpretty/reporters/html.rb | 2 +- lib/xcpretty/syntax.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/xcpretty/reporters/html.rb b/lib/xcpretty/reporters/html.rb index e6509117..568f579c 100644 --- a/lib/xcpretty/reporters/html.rb +++ b/lib/xcpretty/reporters/html.rb @@ -38,7 +38,7 @@ def format_passing_test(suite, test_case, time) def formatted_snippet(filepath) snippet = Snippet.from_filepath(filepath) - Syntax.highlight(snippet) + Syntax.highlight_html(snippet) end diff --git a/lib/xcpretty/syntax.rb b/lib/xcpretty/syntax.rb index 4a47b93a..6778d1d5 100644 --- a/lib/xcpretty/syntax.rb +++ b/lib/xcpretty/syntax.rb @@ -12,7 +12,15 @@ module XCPretty module Syntax def self.highlight(snippet) return snippet.contents unless Rouge + highlight_with_formatter(snippet, Rouge::Formatters::Terminal256.new) + end + + def self.highlight_html(snippet) + return snippet.contents unless Rouge + highlight_with_formatter(snippet, Rouge::Formatters::HTML.new) + end + def self.highlight_with_formatter(snippet, formatter) if snippet.file_path.include?(':') filename = snippet.file_path.rpartition(':').first else @@ -21,7 +29,6 @@ def self.highlight(snippet) lexer = find_lexer(filename, snippet.contents) if lexer - formatter = Rouge::Formatters::Terminal256.new formatter.format(lexer.lex(snippet.contents)) else snippet.contents From 47e4cdf2ce262ebccbdb904c4f687461722fe921 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 13 Sep 2016 17:08:06 -0700 Subject: [PATCH 25/61] Correcting the way Xcode 8 XCUITest failures are parsed --- lib/xcpretty/formatters/formatter.rb | 3 +- lib/xcpretty/parser.rb | 35 +- spec/fixtures/constants.rb | 5 +- spec/fixtures/raw_xcodebuild_uitest_fail.txt | 388 +++++++++++++++++++ spec/xcpretty/parser_spec.rb | 20 +- 5 files changed, 443 insertions(+), 8 deletions(-) create mode 100644 spec/fixtures/raw_xcodebuild_uitest_fail.txt diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index dd84380f..e7251098 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -31,7 +31,7 @@ def format_libtool(library); EMPTY; end def format_passing_test(suite, test, time); EMPTY; end def format_pending_test(suite, test); EMPTY; end def format_measuring_test(suite, test, time); EMPTY; end - def format_failing_test(suite, test, time, file_path); EMPTY; end + def format_failing_test(suite, test, reason, file_path); EMPTY; end def format_process_pch(file); EMPTY; end def format_process_pch_command(file_path); EMPTY; end def format_phase_success(phase_name); EMPTY; end @@ -187,4 +187,3 @@ def warning_symbol end end - diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index c5f33b53..4824c746 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -98,7 +98,12 @@ module Matchers # $2 = test_suite # $3 = test_case # $4 = reason - FAILING_TEST_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ + TEST_FAILURE_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ + + # @regex Captured groups + # $1 = file + # $2 = reason + TEST_UI_FAILURE_MATCHER = /Assertion\sFailure:\s(.+:\d+):\s(.*)/ # @regex Captured groups # $1 = dsym @@ -114,6 +119,12 @@ module Matchers # $3 = architecture LINKING_MATCHER = /^Ld \/?.*\/(.*?) (.*) (.*)$/ + # @regex Captured groups + # $1 = suite + # $2 = test_case + # $3 = time + FAILING_TEST_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\sfailed\s\((\d*\.\d{3})\sseconds\)/ + # @regex Captured groups # $1 = suite # $2 = test_case @@ -323,7 +334,7 @@ def parse(text) formatter.format_cpresource($1) when EXECUTED_MATCHER format_summary_if_needed(text) - when FAILING_TEST_MATCHER + when TEST_FAILURE_MATCHER formatter.format_failing_test($2, $3, $4, $1) when FATAL_ERROR_MATCHER formatter.format_error($1) @@ -343,6 +354,12 @@ def parse(text) formatter.format_measuring_test($1, $2, $3) when PENDING_TEST_MATCHER formatter.format_pending_test($1, $2) + when FAILING_TEST_MATCHER + if @current_assertion_failure + formatter.format_failing_test($1, $2, @current_assertion_failure[:reason], @current_assertion_failure[:file]) + else + formatter.format_failing_test($1, $2, '', '') + end when PASSING_TEST_MATCHER formatter.format_passing_test($1, $2, $3) when PODS_ERROR_MATCHER @@ -392,9 +409,22 @@ def update_test_state(text) @tests_done = false @formatted_summary = false @failures = {} + @assertion_failure = [] + @current_assertion_failure = {} when TESTS_RUN_COMPLETION_MATCHER @tests_done = true + when TEST_UI_FAILURE_MATCHER + @current_assertion_failure = { + file: $1, + reason: $2 + } when FAILING_TEST_MATCHER + if @current_assertion_failure + store_failure(@current_assertion_failure[:file], $1, $2, @current_assertion_failure[:reason]) + else + store_failure(nil, $1, $2, '') + end + when TEST_FAILURE_MATCHER store_failure($1, $2, $3, $4) end end @@ -543,4 +573,3 @@ def unescaped(*escaped_values) end end - diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index 1a70d3b3..b6ac79a2 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -6,12 +6,15 @@ SAMPLE_KIWI_TEST_RUN_BEGINNING = "Test Suite 'ObjectiveRecordTests.xctest' started at 2013-12-10 06:15:39 +0000" SAMPLE_SPECTA_TEST_RUN_BEGINNING = " Test Suite 'KIFTests.xctest' started at 2014-02-28 15:43:42 +0000" SAMPLE_OCUNIT_TEST_RUN_COMPLETION = "Test Suite '/Users/musalj/Library/Developer/Xcode/DerivedData/ReactiveCocoa-eznxkbqvgfsnrvetemqloysuwagb/Build/Products/Test/ReactiveCocoaTests.octest(Tests)' finished at 2013-12-10 07:03:03 +0000." +SAMPLE_OCUNIT_TEST_ASSERTION_FAILURE = " t = 22.27s Assertion Failure: :0: UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect'" SAMPLE_OCUNIT_FAILED_TEST_RUN_COMPLETION = "Test Suite '/Users/dm/someplace/Macadamia.octest' failed at 2014-09-24 23:09:20 +0000." SAMPLE_OCUNIT_PASSED_TEST_RUN_COMPLETION = "Test Suite 'Hazelnuts.xctest' passed at 2014-09-24 23:09:20 +0000." SAMPLE_KIWI_TEST_RUN_COMPLETION = "Test Suite 'ObjectiveRecordTests.xctest' finished at 2013-12-10 06:15:42 +0000." SAMPLE_SPECTA_TEST_RUN_COMPLETION = " Test Suite 'KIFTests.xctest' finished at 2014-02-28 15:44:32 +0000." SAMPLE_OCUNIT_SUITE_BEGINNING = "Test Suite 'RACKVOWrapperSpec' started at 2013-12-10 21:06:10 +0000" +SAMPLE_OCUNIT_CASE_BEGINNING = "Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' started." +SAMPLE_OCUNIT_CASE_FAILURE = "Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' failed (22.490 seconds)." SAMPLE_SPECTA_SUITE_BEGINNING = " Test Suite 'All tests' started at 2014-02-28 19:07:41 +0000" SAMPLE_KIWI_SUITE_COMPLETION = "Test Suite 'All tests' finished at 2013-12-08 04:26:49 +0000." SAMPLE_OCUNIT_SUITE_COMPLETION = "Test Suite '/Users/musalj/Library/Developer/Xcode/DerivedData/ReactiveCocoa-eznxkbqvgfsnrvetemqloysuwagb/Build/Products/Test/ReactiveCocoaTests.octest(Tests)' finished at 2013-12-08 22:09:37 +0000." @@ -33,6 +36,7 @@ builtin-rm -rf /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugarTests.build ) SAMPLE_EXECUTED_TESTS = "Executed 4 tests, with 0 failures (0 unexpected) in 0.003 (0.004) seconds" +SAMPLE_EXECUTED_TESTS_WITH_FAILURE = "Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.513) seconds" SAMPLE_SPECTA_EXECUTED_TESTS = " Executed 4 tests, with 0 failures (0 unexpected) in 10.192 (10.193) seconds" SAMPLE_OCUNIT_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.001 seconds)." SAMPLE_SPECTA_TEST = " Test Case '-[SKWelcomeActivationViewControllerSpecSpec SKWelcomeActivationViewController_When_a_user_enters_their_details_lets_them_enter_a_valid_manager_code]' passed (0.725 seconds)." @@ -611,4 +615,3 @@ %d 1 warning generated. ) - diff --git a/spec/fixtures/raw_xcodebuild_uitest_fail.txt b/spec/fixtures/raw_xcodebuild_uitest_fail.txt new file mode 100644 index 00000000..9bd3b6e4 --- /dev/null +++ b/spec/fixtures/raw_xcodebuild_uitest_fail.txt @@ -0,0 +1,388 @@ +User defaults from command line: + IDETestRunOnlyIdentifiers = ( + "viewUITests/vmtAboutWindow/testConnectToDesktop" +) + IDETestRunSpecificationPath = /Users/viewci/jenkins/workspace/d2/view_macosx10.12-x86_64.xctestrun + +Build settings from command line: + arch = x86_64 + +2016-08-18 09:07:17.632 XCTRunner[21009:1710602] Running tests... +Test Suite 'Selected tests' started at 2016-08-18 09:07:17.820 +Test Suite 'viewUITests.xctest' started at 2016-08-18 09:07:17.821 +Test Suite 'vmtAboutWindow' started at 2016-08-18 09:07:17.821 +Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' started. + t = 0.00s Start Test at 2016-08-18 09:07:17.822 + t = 0.00s Set Up + t = 0.00s Launch com.vmware.horizon + t = 1.38s Wait for app to idle + t = 1.79s Type ' ' into Grid + t = 1.79s Wait for app to idle + t = 1.87s Find the Grid + t = 1.87s Snapshot accessibility hierarchy for com.vmware.horizon + t = 2.44s Find: Descendants matching type Window + t = 2.44s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' + t = 2.44s Find: Descendants matching type ScrollView + t = 2.44s Find: Children matching type Grid + t = 2.45s Synthesize event + t = 2.75s Wait for app to idle + t = 3.09s Click SecureTextField + t = 3.09s Wait for app to idle + t = 3.80s Find the SecureTextField + t = 3.80s Snapshot accessibility hierarchy for com.vmware.horizon + t = 4.03s Find: Descendants matching type Group + t = 4.03s Find: Elements containing elements matching type Image with identifier 'security error' + t = 5.04s Find the SecureTextField (retry 1) + t = 5.04s Snapshot accessibility hierarchy for com.vmware.horizon + t = 5.13s Find: Descendants matching type Group + t = 5.13s Find: Elements containing elements matching type Image with identifier 'security error' + t = 5.13s Find: Children matching type SecureTextField + t = 5.14s Synthesize event + t = 5.45s Wait for app to idle + t = 5.53s Type 'ca$hc0w' into SecureTextField + t = 5.53s Wait for app to idle + t = 5.61s Find the SecureTextField + t = 5.61s Snapshot accessibility hierarchy for com.vmware.horizon + t = 5.70s Find: Descendants matching type Group + t = 5.70s Find: Elements containing elements matching type Image with identifier 'security error' + t = 5.70s Find: Children matching type SecureTextField + t = 5.71s Synthesize event + t = 5.95s Wait for app to idle + t = 6.04s Click "Login" Button + t = 6.04s Wait for app to idle + t = 6.12s Find the "Login" Button + t = 6.12s Snapshot accessibility hierarchy for com.vmware.horizon + t = 6.22s Find: Descendants matching type Button + t = 6.22s Find: Elements matching predicate '"Login" IN identifiers' + t = 6.22s Synthesize event + t = 6.54s Wait for app to idle + t = 6.63s Type 'rdsh1 ' into Grid + t = 6.63s Wait for app to idle + t = 6.71s Find the Grid + t = 6.71s Snapshot accessibility hierarchy for com.vmware.horizon + t = 6.82s Find: Descendants matching type Window + t = 6.83s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' + t = 6.83s Find: Children matching type Group + t = 6.83s Find: Descendants matching type ScrollView + t = 7.83s Find the Grid (retry 1) + t = 7.83s Snapshot accessibility hierarchy for com.vmware.horizon + t = 7.95s Find: Descendants matching type Window + t = 7.96s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' + t = 7.96s Find: Children matching type Group + t = 7.96s Find: Descendants matching type ScrollView + t = 8.97s Find the Grid (retry 2) + t = 8.97s Snapshot accessibility hierarchy for com.vmware.horizon + t = 9.24s Find: Descendants matching type Window + t = 9.24s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' + t = 9.25s Find: Children matching type Group + t = 9.25s Find: Descendants matching type ScrollView + t = 9.25s Find: Children matching type Grid + t = 9.26s Synthesize event + t = 9.44s Wait for app to idle + t = 10.03s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.24s Find: Descendants matching type Window + t = 10.24s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.25s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.33s Find: Descendants matching type Window + t = 10.33s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.33s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.41s Find: Descendants matching type Window + t = 10.42s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.42s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.50s Find: Descendants matching type Window + t = 10.50s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.50s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.58s Find: Descendants matching type Window + t = 10.59s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.59s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.67s Find: Descendants matching type Window + t = 10.67s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.67s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.76s Find: Descendants matching type Window + t = 10.76s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.76s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.84s Find: Descendants matching type Window + t = 10.84s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.84s Snapshot accessibility hierarchy for com.vmware.horizon + t = 10.93s Find: Descendants matching type Window + t = 10.93s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 10.93s Snapshot accessibility hierarchy for com.vmware.horizon + t = 11.02s Find: Descendants matching type Window + t = 11.02s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 11.02s Snapshot accessibility hierarchy for com.vmware.horizon + t = 11.49s Find: Descendants matching type Window + t = 11.49s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 11.49s Snapshot accessibility hierarchy for com.vmware.horizon + t = 11.83s Find: Descendants matching type Window + t = 11.83s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 11.83s Snapshot accessibility hierarchy for com.vmware.horizon + t = 11.94s Find: Descendants matching type Window + t = 11.94s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 11.95s Snapshot accessibility hierarchy for com.vmware.horizon + t = 12.71s Find: Descendants matching type Window + t = 12.71s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 12.72s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.03s Find: Descendants matching type Window + t = 13.03s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.03s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.13s Find: Descendants matching type Window + t = 13.13s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.13s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.56s Find: Descendants matching type Window + t = 13.56s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.56s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.64s Find: Descendants matching type Window + t = 13.64s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.65s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.75s Find: Descendants matching type Window + t = 13.75s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.75s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.83s Find: Descendants matching type Window + t = 13.84s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.84s Snapshot accessibility hierarchy for com.vmware.horizon + t = 13.92s Find: Descendants matching type Window + t = 13.92s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 13.92s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.01s Find: Descendants matching type Window + t = 14.02s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.02s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.10s Find: Descendants matching type Window + t = 14.11s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.11s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.19s Find: Descendants matching type Window + t = 14.19s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.19s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.28s Find: Descendants matching type Window + t = 14.28s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.28s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.37s Find: Descendants matching type Window + t = 14.37s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.37s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.59s Find: Descendants matching type Window + t = 14.59s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.59s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.68s Find: Descendants matching type Window + t = 14.68s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.68s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.78s Find: Descendants matching type Window + t = 14.78s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.79s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.87s Find: Descendants matching type Window + t = 14.88s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.88s Snapshot accessibility hierarchy for com.vmware.horizon + t = 14.96s Find: Descendants matching type Window + t = 14.96s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 14.96s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.04s Find: Descendants matching type Window + t = 15.05s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.05s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.13s Find: Descendants matching type Window + t = 15.14s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.14s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.23s Find: Descendants matching type Window + t = 15.24s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.24s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.33s Find: Descendants matching type Window + t = 15.33s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.33s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.41s Find: Descendants matching type Window + t = 15.42s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.42s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.64s Find: Descendants matching type Window + t = 15.64s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.64s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.72s Find: Descendants matching type Window + t = 15.73s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.73s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.83s Find: Descendants matching type Window + t = 15.83s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.83s Snapshot accessibility hierarchy for com.vmware.horizon + t = 15.92s Find: Descendants matching type Window + t = 15.92s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 15.92s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.00s Find: Descendants matching type Window + t = 16.00s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.00s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.08s Find: Descendants matching type Window + t = 16.09s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.09s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.17s Find: Descendants matching type Window + t = 16.17s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.17s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.26s Find: Descendants matching type Window + t = 16.26s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.26s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.34s Find: Descendants matching type Window + t = 16.35s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.35s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.43s Find: Descendants matching type Window + t = 16.44s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.44s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.66s Find: Descendants matching type Window + t = 16.66s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.66s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.75s Find: Descendants matching type Window + t = 16.75s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.75s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.85s Find: Descendants matching type Window + t = 16.85s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.85s Snapshot accessibility hierarchy for com.vmware.horizon + t = 16.94s Find: Descendants matching type Window + t = 16.94s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 16.94s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.02s Find: Descendants matching type Window + t = 17.02s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.03s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.11s Find: Descendants matching type Window + t = 17.11s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.11s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.20s Find: Descendants matching type Window + t = 17.20s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.20s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.29s Find: Descendants matching type Window + t = 17.29s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.29s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.38s Find: Descendants matching type Window + t = 17.38s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.38s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.46s Find: Descendants matching type Window + t = 17.46s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.47s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.69s Find: Descendants matching type Window + t = 17.70s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.70s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.78s Find: Descendants matching type Window + t = 17.78s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.78s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.89s Find: Descendants matching type Window + t = 17.89s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.89s Snapshot accessibility hierarchy for com.vmware.horizon + t = 17.98s Find: Descendants matching type Window + t = 17.98s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 17.98s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.07s Find: Descendants matching type Window + t = 18.07s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.07s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.16s Find: Descendants matching type Window + t = 18.16s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.16s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.24s Find: Descendants matching type Window + t = 18.25s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.25s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.33s Find: Descendants matching type Window + t = 18.34s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.34s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.43s Find: Descendants matching type Window + t = 18.43s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.43s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.52s Find: Descendants matching type Window + t = 18.52s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.52s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.75s Find: Descendants matching type Window + t = 18.75s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.76s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.84s Find: Descendants matching type Window + t = 18.84s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.84s Snapshot accessibility hierarchy for com.vmware.horizon + t = 18.96s Find: Descendants matching type Window + t = 18.97s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 18.97s Snapshot accessibility hierarchy for com.vmware.horizon + t = 19.05s Find: Descendants matching type Window + t = 19.06s Find: Elements matching predicate '"rdsh1" IN identifiers' +Wait for connect to desktop done + t = 19.06s Snapshot accessibility hierarchy for com.vmware.horizon + t = 20.31s Find: Descendants matching type Window + t = 20.32s Find: Elements matching predicate '"rdsh1" IN identifiers' +Connect to desktop done + t = 20.32s Click "Disconnect" Button + t = 20.32s Wait for app to idle + t = 20.39s Find the "Disconnect" Button + t = 20.39s Snapshot accessibility hierarchy for com.vmware.horizon + t = 20.53s Find: Descendants matching type Window + t = 20.53s Find: Elements matching predicate '"rdsh1" IN identifiers' + t = 21.54s Find the "Disconnect" Button (retry 1) + t = 21.54s Snapshot accessibility hierarchy for com.vmware.horizon + t = 21.80s Find: Descendants matching type Window + t = 21.80s Find: Elements matching predicate '"rdsh1" IN identifiers' + t = 21.81s Find: Descendants matching type Toolbar + t = 21.81s Find: Descendants matching type Button + t = 21.81s Find: Elements matching predicate '"Disconnect" IN identifiers' + t = 21.81s Synthesize event + t = 22.27s Assertion Failure: :0: UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect' + t = 22.29s Tear Down +Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' failed (22.490 seconds). +Test Suite 'vmtAboutWindow' failed at 2016-08-18 09:07:40.331. + Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.510) seconds +Test Suite 'viewUITests.xctest' failed at 2016-08-18 09:07:40.332. + Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.511) seconds +Test Suite 'Selected tests' failed at 2016-08-18 09:07:40.332. + Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.513) seconds diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 0bca3e35..a5916491 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -7,7 +7,6 @@ module XCPretty describe Parser do - before(:each) do @formatter = Formatter.new(false, false) @parser = Parser.new(@formatter) @@ -321,6 +320,12 @@ module XCPretty @parser.parse(SAMPLE_OCUNIT_PASSED_TEST_RUN_COMPLETION) end + it "parses ocunit test assertion failure" do + @formatter.should receive(:format_failing_test).with('viewUITests.vmtAboutWindow', 'testConnectToDesktop', "UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect'", ':0') + @parser.parse(SAMPLE_OCUNIT_TEST_ASSERTION_FAILURE) + @parser.parse(SAMPLE_OCUNIT_CASE_FAILURE) + end + it "parses ocunit test run failed" do @formatter.should receive(:format_test_run_finished).with('Macadamia.octest', '2014-09-24 23:09:20 +0000.') @parser.parse(SAMPLE_OCUNIT_FAILED_TEST_RUN_COMPLETION) @@ -494,6 +499,10 @@ def given_tests_have_started(reporter = SAMPLE_OCUNIT_TEST_RUN_BEGINNING) @parser.parse(reporter) end + def given_a_test_failed(reporter = SAMPLE_OCUNIT_CASE_FAILURE) + @parser.parse(reporter) + end + def given_tests_are_done(reporter = SAMPLE_OCUNIT_TEST_RUN_COMPLETION) @parser.parse(reporter) end @@ -534,6 +543,14 @@ def given_kiwi_tests_are_done } end + it "knows when tests fail for XCTest" do + @formatter.should_receive(:format_test_summary).once + given_tests_have_started + given_a_test_failed + given_tests_are_done + @parser.parse(SAMPLE_EXECUTED_TESTS_WITH_FAILURE) + end + it "prints OCunit / XCTest summary twice if tests executed twice" do @formatter.should_receive(:format_test_summary).twice 2.times { @@ -554,4 +571,3 @@ def given_kiwi_tests_are_done end end - From 4b90228e80dd74dbdb209553668178023447ff85 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Tue, 27 Sep 2016 22:47:20 -0700 Subject: [PATCH 26/61] add back -c short flag --- bin/xcpretty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/xcpretty b/bin/xcpretty index 7463a328..c42f1b0c 100755 --- a/bin/xcpretty +++ b/bin/xcpretty @@ -41,7 +41,7 @@ OptionParser.new do |opts| opts.on('-f', '--formatter PATH', 'Use formatter returned from evaluating the specified Ruby file') do |path| printer_opts[:formatter] = XCPretty.load_custom_class(path) end - opts.on('--[no-]color', 'Use colorized output. Defaults is auto') do |value| + opts.on('-c', '--[no-]color', 'Use colorized output. Default is auto') do |value| printer_opts[:colorize] = value end opts.on('--[no-]utf', 'Use unicode characters in output. Default is auto.') do |value| From c33d5afaae693aed2698881825c299ff296b5f31 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Tue, 27 Sep 2016 23:06:47 -0700 Subject: [PATCH 27/61] bump version to 0.2.3 --- lib/xcpretty/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index 3eb34f36..442526bf 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.2" + VERSION = "0.2.3" end From 5dbee66f2cc62bf046d5ced14fd155d2e54013b8 Mon Sep 17 00:00:00 2001 From: Maksym Grebenets Date: Sat, 8 Oct 2016 15:05:44 +1100 Subject: [PATCH 28/61] Handle 'TargetName will not be code signed because' warning --- features/simple_format.feature | 6 +++++- features/steps/formatting_steps.rb | 9 ++++++++- lib/xcpretty/formatters/formatter.rb | 4 ++++ lib/xcpretty/parser.rb | 6 ++++++ spec/fixtures/constants.rb | 2 ++ spec/xcpretty/formatters/formatter_spec.rb | 5 ++++- spec/xcpretty/parser_spec.rb | 5 +++++ 7 files changed, 34 insertions(+), 3 deletions(-) diff --git a/features/simple_format.feature b/features/simple_format.feature index d082570e..f4199bc0 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -167,6 +167,11 @@ Feature: Showing build output in simple format When I pipe to xcpretty with "--simple --no-color" Then I should see a successful code signing message + Scenario: Showing target will not be code signed warning + Given I have a target which will not be code signed + When I pipe to xcpretty with "--simple --color" + Then I should see a target will not be code signed warning + Scenario: Showing preprocess Given I have a file to preprocess When I pipe to xcpretty with "--simple --no-color" @@ -206,4 +211,3 @@ Feature: Showing build output in simple format Given there were warnings in the code When I pipe to xcpretty with "--simple --color" Then I should see a yellow warning message - diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index 45cbb6d6..029d3869 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -68,6 +68,10 @@ add_run_input SAMPLE_CODESIGN_FRAMEWORK end +Given(/^I have a target which will not be code signed$/) do + add_run_input SAMPLE_WILL_NOT_BE_CODE_SIGNED +end + Given(/^I have a file to preprocess$/) do add_run_input SAMPLE_PREPROCESS end @@ -185,6 +189,10 @@ run_output.should start_with("▸ Signing") end +Then(/^I should see a target will not be code signed warning$/) do + run_output.should include(yellow("⚠️ FrameworkName will not be code signed because its settings don't specify a development team.")) +end + Then(/^I should see a successful preprocessing message$/) do run_output.should start_with("▸ Preprocessing") end @@ -335,4 +343,3 @@ Then(/^I should see text matching "(.*?)"$/) do |text| run_output.lines.to_a.last.strip.should == text end - diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index e7251098..f7919398 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -148,6 +148,10 @@ def format_duplicate_symbols(message, file_paths) "> #{file_paths.map { |path| path.split('/').last }.join("\n> ")}\n" end + def format_will_not_be_code_signed(message) + "#{yellow(warning_symbol + " " + message)}" + end + private diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 4824c746..37cdc2fd 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -211,6 +211,10 @@ module Warnings # @regex Captured groups # $1 = whole warning GENERIC_WARNING_MATCHER = /^warning:\s(.*)$/ + + # @regex Captured groups + # $1 = whole warning + WILL_NOT_BE_CODE_SIGNED_MATCHER = /^(.* will not be code signed because .*)$/ end module Errors @@ -396,6 +400,8 @@ def parse(text) formatter.format_shell_command($1, $2) when GENERIC_WARNING_MATCHER formatter.format_warning($1) + when WILL_NOT_BE_CODE_SIGNED_MATCHER + formatter.format_will_not_be_code_signed($1) else "" end diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index b6ac79a2..cb516cb8 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -615,3 +615,5 @@ %d 1 warning generated. ) + +SAMPLE_WILL_NOT_BE_CODE_SIGNED = "FrameworkName will not be code signed because its settings don't specify a development team." diff --git a/spec/xcpretty/formatters/formatter_spec.rb b/spec/xcpretty/formatters/formatter_spec.rb index 207bc60e..06f1920f 100644 --- a/spec/xcpretty/formatters/formatter_spec.rb +++ b/spec/xcpretty/formatters/formatter_spec.rb @@ -91,6 +91,10 @@ module XCPretty ) end + it "formats will not be code signed warnings" do + @formatter.format_will_not_be_code_signed(SAMPLE_WILL_NOT_BE_CODE_SIGNED).should == "#{@formatter.yellow("⚠️ FrameworkName will not be code signed because its settings don't specify a development team.")}" + end + it "formats failures per suite" do Syntax.stub(:highlight) { |snippet| snippet.contents } @@ -137,4 +141,3 @@ module XCPretty end end end - diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index a5916491..9ae7fb78 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -492,6 +492,11 @@ module XCPretty @formatter.should receive(:format_ld_warning).with("ld: embedded dylibs/frameworks only run on iOS 8 or later") @parser.parse("ld: warning: embedded dylibs/frameworks only run on iOS 8 or later") end + + it "parses will not be code signed warnings" do + @formatter.should receive(:format_will_not_be_code_signed).with(SAMPLE_WILL_NOT_BE_CODE_SIGNED) + @parser.parse(SAMPLE_WILL_NOT_BE_CODE_SIGNED) + end end context "summary" do From 8ed2ef2d680d5b10bb2f80fb6b9e8777bb2239c7 Mon Sep 17 00:00:00 2001 From: Maksym Grebenets Date: Sat, 8 Oct 2016 16:39:13 +1100 Subject: [PATCH 29/61] Display failed dependency checks as errors - Provisioning profile doesn't support capability - Provisioning profile doesn't include entitlement - Code signing is required for ... --- features/simple_format.feature | 15 +++++++++++++++ features/steps/formatting_steps.rb | 24 ++++++++++++++++++++++++ lib/xcpretty/parser.rb | 12 ++++++++++++ spec/fixtures/constants.rb | 11 +++++++++++ spec/xcpretty/parser_spec.rb | 15 +++++++++++++++ 5 files changed, 77 insertions(+) diff --git a/features/simple_format.feature b/features/simple_format.feature index f4199bc0..5b7c8190 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -211,3 +211,18 @@ Feature: Showing build output in simple format Given there were warnings in the code When I pipe to xcpretty with "--simple --color" Then I should see a yellow warning message + + Scenario: Showing provisioning profile doesn't support capability + Given the provisioning profile doesn't support capability + When I pipe to xcpretty with "--simple --no-color" + Then I should see the profile doesn't support capability message + + Scenario: Showing provisioning profile doesn't include entitlement + Given the provisioning profile doesn't include entitlement + When I pipe to xcpretty with "--simple --no-color" + Then I should see the profile doesn't include entitlement message + + Scenario: Showing code signing is required error + Given the target requires code signing + When I pipe to xcpretty with "--simple --no-color" + Then I should see the code signing is requried message \ No newline at end of file diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index 029d3869..67be0bba 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -132,6 +132,18 @@ add_run_input SAMPLE_CLEAN_SUCCEEDED end +Given(/^the provisioning profile doesn't support capability$/) do + add_run_input SAMPLE_PROFILE_DOESNT_SUPPORT_CAPABILITY_ERROR +end + +Given(/^the provisioning profile doesn't include entitlement$/) do + add_run_input SAMPLE_PROFILE_DOESNT_INCLUDE_ENTITLEMENT_ERROR +end + +Given(/^the target requires code signing$/) do + add_run_input SAMPLE_CODE_SIGNING_IS_REQUIRED_ERROR +end + Then(/^I should see a "(\w+)" completion message$/) do |phase| run_output.should start_with("▸ #{phase.capitalize} Succeeded") end @@ -343,3 +355,15 @@ Then(/^I should see text matching "(.*?)"$/) do |text| run_output.lines.to_a.last.strip.should == text end + +Then(/^I should see the profile doesn't support capability message$/) do + run_output.should include("Provisioning profile \"Profile Name\" doesn't support the Push Notifications capability.") +end + +Then(/^I should see the profile doesn't include entitlement message$/) do + run_output.should include("Provisioning profile \"Profile Name\" doesn't include the aps-environment entitlement.") +end + +Then(/^I should see the code signing is requried message$/) do + run_output.should include("Code signing is required for product type 'Application' in SDK 'iOS 10.0'") +end diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 37cdc2fd..361cd5bb 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -226,6 +226,10 @@ module Errors # $1 = whole error CODESIGN_ERROR_MATCHER = /^(Code\s?Sign error:.*)$/ + # @regex Captured groups + # $1 = whole error + CODE_SIGNING_REQUIRED_MATCHER = /^(Code signing is required for product type .* in SDK .*)$/ + # @regex Captured groups # $1 = file_path # $2 = file_name @@ -236,6 +240,10 @@ module Errors # $1 cursor (with whitespaces and tildes) CURSOR_MATCHER = /^([\s~]*\^[\s~]*)$/ + # @regex Captured groups + # $1 = whole message + PROFILE_DOESNT_SUPPORT_OR_INCLUDE = /^(Provisioning profile .* doesn't .*)$/ + # @regex Captured groups # $1 = whole error. # it varies a lot, not sure if it makes sense to catch everything separately @@ -322,6 +330,8 @@ def parse(text) formatter.format_codesign($1) when CODESIGN_ERROR_MATCHER formatter.format_error($1) + when CODE_SIGNING_REQUIRED_MATCHER + formatter.format_error($1) when COMPILE_MATCHER formatter.format_compile($2, $1) when COMPILE_COMMAND_MATCHER @@ -336,6 +346,8 @@ def parse(text) formatter.format_copy_plist_file($1, $2) when CPRESOURCE_MATCHER formatter.format_cpresource($1) + when PROFILE_DOESNT_SUPPORT_OR_INCLUDE + formatter.format_error($1) when EXECUTED_MATCHER format_summary_if_needed(text) when TEST_FAILURE_MATCHER diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index cb516cb8..f124c781 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -603,6 +603,17 @@ ~~ ^~~~~~~ ) +SAMPLE_PROFILE_DOESNT_SUPPORT_CAPABILITY_ERROR = %Q( +Provisioning profile "Profile Name" doesn't support the Push Notifications capability. +) + +SAMPLE_PROFILE_DOESNT_INCLUDE_ENTITLEMENT_ERROR = %Q( +Provisioning profile "Profile Name" doesn't include the aps-environment entitlement. +) + +SAMPLE_CODE_SIGNING_IS_REQUIRED_ERROR = %Q( +Code signing is required for product type 'Application' in SDK 'iOS 10.0' +) ################################################################################ # WARNINGS diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 9ae7fb78..6206036a 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -468,6 +468,21 @@ module XCPretty @formatter.should_not receive(:format_compile_error) @parser.parse("hohohoooo") end + + it "parses provisioning profile doesn't support capability error" do + @formatter.should receive(:format_error) + @parser.parse(SAMPLE_PROFILE_DOESNT_SUPPORT_CAPABILITY_ERROR) + end + + it "parses provisioning profile doesn't include entitlement error" do + @formatter.should receive(:format_error) + @parser.parse(SAMPLE_PROFILE_DOESNT_INCLUDE_ENTITLEMENT_ERROR) + end + + it "parses code signing is required error" do + @formatter.should receive(:format_error) + @parser.parse(SAMPLE_CODE_SIGNING_IS_REQUIRED_ERROR) + end end context "warnings" do From 28a56ab8920e0f683b689c7f8548bc05b8aa6806 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Sun, 9 Oct 2016 17:51:59 -0700 Subject: [PATCH 30/61] Revert "Correcting the way Xcode 8 XCUITest failures are parsed" This reverts commit 47e4cdf2ce262ebccbdb904c4f687461722fe921. --- lib/xcpretty/formatters/formatter.rb | 3 +- lib/xcpretty/parser.rb | 35 +- spec/fixtures/constants.rb | 4 - spec/fixtures/raw_xcodebuild_uitest_fail.txt | 388 ------------------- spec/xcpretty/parser_spec.rb | 20 +- 5 files changed, 7 insertions(+), 443 deletions(-) delete mode 100644 spec/fixtures/raw_xcodebuild_uitest_fail.txt diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index f7919398..404d1f10 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -31,7 +31,7 @@ def format_libtool(library); EMPTY; end def format_passing_test(suite, test, time); EMPTY; end def format_pending_test(suite, test); EMPTY; end def format_measuring_test(suite, test, time); EMPTY; end - def format_failing_test(suite, test, reason, file_path); EMPTY; end + def format_failing_test(suite, test, time, file_path); EMPTY; end def format_process_pch(file); EMPTY; end def format_process_pch_command(file_path); EMPTY; end def format_phase_success(phase_name); EMPTY; end @@ -191,3 +191,4 @@ def warning_symbol end end + diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 361cd5bb..f9ed669a 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -98,12 +98,7 @@ module Matchers # $2 = test_suite # $3 = test_case # $4 = reason - TEST_FAILURE_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ - - # @regex Captured groups - # $1 = file - # $2 = reason - TEST_UI_FAILURE_MATCHER = /Assertion\sFailure:\s(.+:\d+):\s(.*)/ + FAILING_TEST_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ # @regex Captured groups # $1 = dsym @@ -119,12 +114,6 @@ module Matchers # $3 = architecture LINKING_MATCHER = /^Ld \/?.*\/(.*?) (.*) (.*)$/ - # @regex Captured groups - # $1 = suite - # $2 = test_case - # $3 = time - FAILING_TEST_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\sfailed\s\((\d*\.\d{3})\sseconds\)/ - # @regex Captured groups # $1 = suite # $2 = test_case @@ -350,7 +339,7 @@ def parse(text) formatter.format_error($1) when EXECUTED_MATCHER format_summary_if_needed(text) - when TEST_FAILURE_MATCHER + when FAILING_TEST_MATCHER formatter.format_failing_test($2, $3, $4, $1) when FATAL_ERROR_MATCHER formatter.format_error($1) @@ -370,12 +359,6 @@ def parse(text) formatter.format_measuring_test($1, $2, $3) when PENDING_TEST_MATCHER formatter.format_pending_test($1, $2) - when FAILING_TEST_MATCHER - if @current_assertion_failure - formatter.format_failing_test($1, $2, @current_assertion_failure[:reason], @current_assertion_failure[:file]) - else - formatter.format_failing_test($1, $2, '', '') - end when PASSING_TEST_MATCHER formatter.format_passing_test($1, $2, $3) when PODS_ERROR_MATCHER @@ -427,22 +410,9 @@ def update_test_state(text) @tests_done = false @formatted_summary = false @failures = {} - @assertion_failure = [] - @current_assertion_failure = {} when TESTS_RUN_COMPLETION_MATCHER @tests_done = true - when TEST_UI_FAILURE_MATCHER - @current_assertion_failure = { - file: $1, - reason: $2 - } when FAILING_TEST_MATCHER - if @current_assertion_failure - store_failure(@current_assertion_failure[:file], $1, $2, @current_assertion_failure[:reason]) - else - store_failure(nil, $1, $2, '') - end - when TEST_FAILURE_MATCHER store_failure($1, $2, $3, $4) end end @@ -591,3 +561,4 @@ def unescaped(*escaped_values) end end + diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index f124c781..a5e4f81c 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -6,15 +6,12 @@ SAMPLE_KIWI_TEST_RUN_BEGINNING = "Test Suite 'ObjectiveRecordTests.xctest' started at 2013-12-10 06:15:39 +0000" SAMPLE_SPECTA_TEST_RUN_BEGINNING = " Test Suite 'KIFTests.xctest' started at 2014-02-28 15:43:42 +0000" SAMPLE_OCUNIT_TEST_RUN_COMPLETION = "Test Suite '/Users/musalj/Library/Developer/Xcode/DerivedData/ReactiveCocoa-eznxkbqvgfsnrvetemqloysuwagb/Build/Products/Test/ReactiveCocoaTests.octest(Tests)' finished at 2013-12-10 07:03:03 +0000." -SAMPLE_OCUNIT_TEST_ASSERTION_FAILURE = " t = 22.27s Assertion Failure: :0: UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect'" SAMPLE_OCUNIT_FAILED_TEST_RUN_COMPLETION = "Test Suite '/Users/dm/someplace/Macadamia.octest' failed at 2014-09-24 23:09:20 +0000." SAMPLE_OCUNIT_PASSED_TEST_RUN_COMPLETION = "Test Suite 'Hazelnuts.xctest' passed at 2014-09-24 23:09:20 +0000." SAMPLE_KIWI_TEST_RUN_COMPLETION = "Test Suite 'ObjectiveRecordTests.xctest' finished at 2013-12-10 06:15:42 +0000." SAMPLE_SPECTA_TEST_RUN_COMPLETION = " Test Suite 'KIFTests.xctest' finished at 2014-02-28 15:44:32 +0000." SAMPLE_OCUNIT_SUITE_BEGINNING = "Test Suite 'RACKVOWrapperSpec' started at 2013-12-10 21:06:10 +0000" -SAMPLE_OCUNIT_CASE_BEGINNING = "Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' started." -SAMPLE_OCUNIT_CASE_FAILURE = "Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' failed (22.490 seconds)." SAMPLE_SPECTA_SUITE_BEGINNING = " Test Suite 'All tests' started at 2014-02-28 19:07:41 +0000" SAMPLE_KIWI_SUITE_COMPLETION = "Test Suite 'All tests' finished at 2013-12-08 04:26:49 +0000." SAMPLE_OCUNIT_SUITE_COMPLETION = "Test Suite '/Users/musalj/Library/Developer/Xcode/DerivedData/ReactiveCocoa-eznxkbqvgfsnrvetemqloysuwagb/Build/Products/Test/ReactiveCocoaTests.octest(Tests)' finished at 2013-12-08 22:09:37 +0000." @@ -36,7 +33,6 @@ builtin-rm -rf /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugarTests.build ) SAMPLE_EXECUTED_TESTS = "Executed 4 tests, with 0 failures (0 unexpected) in 0.003 (0.004) seconds" -SAMPLE_EXECUTED_TESTS_WITH_FAILURE = "Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.513) seconds" SAMPLE_SPECTA_EXECUTED_TESTS = " Executed 4 tests, with 0 failures (0 unexpected) in 10.192 (10.193) seconds" SAMPLE_OCUNIT_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.001 seconds)." SAMPLE_SPECTA_TEST = " Test Case '-[SKWelcomeActivationViewControllerSpecSpec SKWelcomeActivationViewController_When_a_user_enters_their_details_lets_them_enter_a_valid_manager_code]' passed (0.725 seconds)." diff --git a/spec/fixtures/raw_xcodebuild_uitest_fail.txt b/spec/fixtures/raw_xcodebuild_uitest_fail.txt deleted file mode 100644 index 9bd3b6e4..00000000 --- a/spec/fixtures/raw_xcodebuild_uitest_fail.txt +++ /dev/null @@ -1,388 +0,0 @@ -User defaults from command line: - IDETestRunOnlyIdentifiers = ( - "viewUITests/vmtAboutWindow/testConnectToDesktop" -) - IDETestRunSpecificationPath = /Users/viewci/jenkins/workspace/d2/view_macosx10.12-x86_64.xctestrun - -Build settings from command line: - arch = x86_64 - -2016-08-18 09:07:17.632 XCTRunner[21009:1710602] Running tests... -Test Suite 'Selected tests' started at 2016-08-18 09:07:17.820 -Test Suite 'viewUITests.xctest' started at 2016-08-18 09:07:17.821 -Test Suite 'vmtAboutWindow' started at 2016-08-18 09:07:17.821 -Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' started. - t = 0.00s Start Test at 2016-08-18 09:07:17.822 - t = 0.00s Set Up - t = 0.00s Launch com.vmware.horizon - t = 1.38s Wait for app to idle - t = 1.79s Type ' ' into Grid - t = 1.79s Wait for app to idle - t = 1.87s Find the Grid - t = 1.87s Snapshot accessibility hierarchy for com.vmware.horizon - t = 2.44s Find: Descendants matching type Window - t = 2.44s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' - t = 2.44s Find: Descendants matching type ScrollView - t = 2.44s Find: Children matching type Grid - t = 2.45s Synthesize event - t = 2.75s Wait for app to idle - t = 3.09s Click SecureTextField - t = 3.09s Wait for app to idle - t = 3.80s Find the SecureTextField - t = 3.80s Snapshot accessibility hierarchy for com.vmware.horizon - t = 4.03s Find: Descendants matching type Group - t = 4.03s Find: Elements containing elements matching type Image with identifier 'security error' - t = 5.04s Find the SecureTextField (retry 1) - t = 5.04s Snapshot accessibility hierarchy for com.vmware.horizon - t = 5.13s Find: Descendants matching type Group - t = 5.13s Find: Elements containing elements matching type Image with identifier 'security error' - t = 5.13s Find: Children matching type SecureTextField - t = 5.14s Synthesize event - t = 5.45s Wait for app to idle - t = 5.53s Type 'ca$hc0w' into SecureTextField - t = 5.53s Wait for app to idle - t = 5.61s Find the SecureTextField - t = 5.61s Snapshot accessibility hierarchy for com.vmware.horizon - t = 5.70s Find: Descendants matching type Group - t = 5.70s Find: Elements containing elements matching type Image with identifier 'security error' - t = 5.70s Find: Children matching type SecureTextField - t = 5.71s Synthesize event - t = 5.95s Wait for app to idle - t = 6.04s Click "Login" Button - t = 6.04s Wait for app to idle - t = 6.12s Find the "Login" Button - t = 6.12s Snapshot accessibility hierarchy for com.vmware.horizon - t = 6.22s Find: Descendants matching type Button - t = 6.22s Find: Elements matching predicate '"Login" IN identifiers' - t = 6.22s Synthesize event - t = 6.54s Wait for app to idle - t = 6.63s Type 'rdsh1 ' into Grid - t = 6.63s Wait for app to idle - t = 6.71s Find the Grid - t = 6.71s Snapshot accessibility hierarchy for com.vmware.horizon - t = 6.82s Find: Descendants matching type Window - t = 6.83s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' - t = 6.83s Find: Children matching type Group - t = 6.83s Find: Descendants matching type ScrollView - t = 7.83s Find the Grid (retry 1) - t = 7.83s Snapshot accessibility hierarchy for com.vmware.horizon - t = 7.95s Find: Descendants matching type Window - t = 7.96s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' - t = 7.96s Find: Children matching type Group - t = 7.96s Find: Descendants matching type ScrollView - t = 8.97s Find the Grid (retry 2) - t = 8.97s Snapshot accessibility hierarchy for com.vmware.horizon - t = 9.24s Find: Descendants matching type Window - t = 9.24s Find: Elements matching predicate '"VMware Horizon Client" IN identifiers' - t = 9.25s Find: Children matching type Group - t = 9.25s Find: Descendants matching type ScrollView - t = 9.25s Find: Children matching type Grid - t = 9.26s Synthesize event - t = 9.44s Wait for app to idle - t = 10.03s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.24s Find: Descendants matching type Window - t = 10.24s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.25s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.33s Find: Descendants matching type Window - t = 10.33s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.33s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.41s Find: Descendants matching type Window - t = 10.42s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.42s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.50s Find: Descendants matching type Window - t = 10.50s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.50s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.58s Find: Descendants matching type Window - t = 10.59s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.59s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.67s Find: Descendants matching type Window - t = 10.67s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.67s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.76s Find: Descendants matching type Window - t = 10.76s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.76s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.84s Find: Descendants matching type Window - t = 10.84s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.84s Snapshot accessibility hierarchy for com.vmware.horizon - t = 10.93s Find: Descendants matching type Window - t = 10.93s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 10.93s Snapshot accessibility hierarchy for com.vmware.horizon - t = 11.02s Find: Descendants matching type Window - t = 11.02s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 11.02s Snapshot accessibility hierarchy for com.vmware.horizon - t = 11.49s Find: Descendants matching type Window - t = 11.49s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 11.49s Snapshot accessibility hierarchy for com.vmware.horizon - t = 11.83s Find: Descendants matching type Window - t = 11.83s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 11.83s Snapshot accessibility hierarchy for com.vmware.horizon - t = 11.94s Find: Descendants matching type Window - t = 11.94s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 11.95s Snapshot accessibility hierarchy for com.vmware.horizon - t = 12.71s Find: Descendants matching type Window - t = 12.71s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 12.72s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.03s Find: Descendants matching type Window - t = 13.03s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.03s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.13s Find: Descendants matching type Window - t = 13.13s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.13s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.56s Find: Descendants matching type Window - t = 13.56s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.56s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.64s Find: Descendants matching type Window - t = 13.64s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.65s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.75s Find: Descendants matching type Window - t = 13.75s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.75s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.83s Find: Descendants matching type Window - t = 13.84s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.84s Snapshot accessibility hierarchy for com.vmware.horizon - t = 13.92s Find: Descendants matching type Window - t = 13.92s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 13.92s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.01s Find: Descendants matching type Window - t = 14.02s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.02s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.10s Find: Descendants matching type Window - t = 14.11s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.11s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.19s Find: Descendants matching type Window - t = 14.19s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.19s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.28s Find: Descendants matching type Window - t = 14.28s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.28s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.37s Find: Descendants matching type Window - t = 14.37s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.37s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.59s Find: Descendants matching type Window - t = 14.59s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.59s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.68s Find: Descendants matching type Window - t = 14.68s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.68s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.78s Find: Descendants matching type Window - t = 14.78s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.79s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.87s Find: Descendants matching type Window - t = 14.88s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.88s Snapshot accessibility hierarchy for com.vmware.horizon - t = 14.96s Find: Descendants matching type Window - t = 14.96s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 14.96s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.04s Find: Descendants matching type Window - t = 15.05s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.05s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.13s Find: Descendants matching type Window - t = 15.14s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.14s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.23s Find: Descendants matching type Window - t = 15.24s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.24s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.33s Find: Descendants matching type Window - t = 15.33s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.33s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.41s Find: Descendants matching type Window - t = 15.42s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.42s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.64s Find: Descendants matching type Window - t = 15.64s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.64s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.72s Find: Descendants matching type Window - t = 15.73s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.73s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.83s Find: Descendants matching type Window - t = 15.83s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.83s Snapshot accessibility hierarchy for com.vmware.horizon - t = 15.92s Find: Descendants matching type Window - t = 15.92s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 15.92s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.00s Find: Descendants matching type Window - t = 16.00s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.00s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.08s Find: Descendants matching type Window - t = 16.09s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.09s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.17s Find: Descendants matching type Window - t = 16.17s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.17s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.26s Find: Descendants matching type Window - t = 16.26s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.26s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.34s Find: Descendants matching type Window - t = 16.35s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.35s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.43s Find: Descendants matching type Window - t = 16.44s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.44s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.66s Find: Descendants matching type Window - t = 16.66s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.66s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.75s Find: Descendants matching type Window - t = 16.75s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.75s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.85s Find: Descendants matching type Window - t = 16.85s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.85s Snapshot accessibility hierarchy for com.vmware.horizon - t = 16.94s Find: Descendants matching type Window - t = 16.94s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 16.94s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.02s Find: Descendants matching type Window - t = 17.02s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.03s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.11s Find: Descendants matching type Window - t = 17.11s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.11s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.20s Find: Descendants matching type Window - t = 17.20s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.20s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.29s Find: Descendants matching type Window - t = 17.29s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.29s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.38s Find: Descendants matching type Window - t = 17.38s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.38s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.46s Find: Descendants matching type Window - t = 17.46s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.47s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.69s Find: Descendants matching type Window - t = 17.70s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.70s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.78s Find: Descendants matching type Window - t = 17.78s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.78s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.89s Find: Descendants matching type Window - t = 17.89s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.89s Snapshot accessibility hierarchy for com.vmware.horizon - t = 17.98s Find: Descendants matching type Window - t = 17.98s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 17.98s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.07s Find: Descendants matching type Window - t = 18.07s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.07s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.16s Find: Descendants matching type Window - t = 18.16s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.16s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.24s Find: Descendants matching type Window - t = 18.25s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.25s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.33s Find: Descendants matching type Window - t = 18.34s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.34s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.43s Find: Descendants matching type Window - t = 18.43s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.43s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.52s Find: Descendants matching type Window - t = 18.52s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.52s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.75s Find: Descendants matching type Window - t = 18.75s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.76s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.84s Find: Descendants matching type Window - t = 18.84s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.84s Snapshot accessibility hierarchy for com.vmware.horizon - t = 18.96s Find: Descendants matching type Window - t = 18.97s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 18.97s Snapshot accessibility hierarchy for com.vmware.horizon - t = 19.05s Find: Descendants matching type Window - t = 19.06s Find: Elements matching predicate '"rdsh1" IN identifiers' -Wait for connect to desktop done - t = 19.06s Snapshot accessibility hierarchy for com.vmware.horizon - t = 20.31s Find: Descendants matching type Window - t = 20.32s Find: Elements matching predicate '"rdsh1" IN identifiers' -Connect to desktop done - t = 20.32s Click "Disconnect" Button - t = 20.32s Wait for app to idle - t = 20.39s Find the "Disconnect" Button - t = 20.39s Snapshot accessibility hierarchy for com.vmware.horizon - t = 20.53s Find: Descendants matching type Window - t = 20.53s Find: Elements matching predicate '"rdsh1" IN identifiers' - t = 21.54s Find the "Disconnect" Button (retry 1) - t = 21.54s Snapshot accessibility hierarchy for com.vmware.horizon - t = 21.80s Find: Descendants matching type Window - t = 21.80s Find: Elements matching predicate '"rdsh1" IN identifiers' - t = 21.81s Find: Descendants matching type Toolbar - t = 21.81s Find: Descendants matching type Button - t = 21.81s Find: Elements matching predicate '"Disconnect" IN identifiers' - t = 21.81s Synthesize event - t = 22.27s Assertion Failure: :0: UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect' - t = 22.29s Tear Down -Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' failed (22.490 seconds). -Test Suite 'vmtAboutWindow' failed at 2016-08-18 09:07:40.331. - Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.510) seconds -Test Suite 'viewUITests.xctest' failed at 2016-08-18 09:07:40.332. - Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.511) seconds -Test Suite 'Selected tests' failed at 2016-08-18 09:07:40.332. - Executed 1 test, with 1 failure (0 unexpected) in 22.490 (22.513) seconds diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 6206036a..3351bd5a 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -7,6 +7,7 @@ module XCPretty describe Parser do + before(:each) do @formatter = Formatter.new(false, false) @parser = Parser.new(@formatter) @@ -320,12 +321,6 @@ module XCPretty @parser.parse(SAMPLE_OCUNIT_PASSED_TEST_RUN_COMPLETION) end - it "parses ocunit test assertion failure" do - @formatter.should receive(:format_failing_test).with('viewUITests.vmtAboutWindow', 'testConnectToDesktop', "UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect'", ':0') - @parser.parse(SAMPLE_OCUNIT_TEST_ASSERTION_FAILURE) - @parser.parse(SAMPLE_OCUNIT_CASE_FAILURE) - end - it "parses ocunit test run failed" do @formatter.should receive(:format_test_run_finished).with('Macadamia.octest', '2014-09-24 23:09:20 +0000.') @parser.parse(SAMPLE_OCUNIT_FAILED_TEST_RUN_COMPLETION) @@ -519,10 +514,6 @@ def given_tests_have_started(reporter = SAMPLE_OCUNIT_TEST_RUN_BEGINNING) @parser.parse(reporter) end - def given_a_test_failed(reporter = SAMPLE_OCUNIT_CASE_FAILURE) - @parser.parse(reporter) - end - def given_tests_are_done(reporter = SAMPLE_OCUNIT_TEST_RUN_COMPLETION) @parser.parse(reporter) end @@ -563,14 +554,6 @@ def given_kiwi_tests_are_done } end - it "knows when tests fail for XCTest" do - @formatter.should_receive(:format_test_summary).once - given_tests_have_started - given_a_test_failed - given_tests_are_done - @parser.parse(SAMPLE_EXECUTED_TESTS_WITH_FAILURE) - end - it "prints OCunit / XCTest summary twice if tests executed twice" do @formatter.should_receive(:format_test_summary).twice 2.times { @@ -591,3 +574,4 @@ def given_kiwi_tests_are_done end end + From 27ed14bd604baf47921232bad158f678305d7db7 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 18:27:40 -0700 Subject: [PATCH 31/61] correct parameter --- lib/xcpretty/formatters/formatter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index 404d1f10..dbd8aa33 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -31,7 +31,7 @@ def format_libtool(library); EMPTY; end def format_passing_test(suite, test, time); EMPTY; end def format_pending_test(suite, test); EMPTY; end def format_measuring_test(suite, test, time); EMPTY; end - def format_failing_test(suite, test, time, file_path); EMPTY; end + def format_failing_test(suite, test, reason, file_path); EMPTY; end def format_process_pch(file); EMPTY; end def format_process_pch_command(file_path); EMPTY; end def format_phase_success(phase_name); EMPTY; end From b15de8ff9958c9954c2e99fc33c1c05e4a1b85ef Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 18:48:01 -0700 Subject: [PATCH 32/61] add back support for ui tests --- lib/xcpretty/parser.rb | 28 +++++++++++++++++++++++----- spec/fixtures/constants.rb | 30 ++++++++++++++++++++++++++++++ spec/xcpretty/parser_spec.rb | 10 ++++++++++ 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index f9ed669a..72c1d3b8 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -100,6 +100,11 @@ module Matchers # $4 = reason FAILING_TEST_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ + # @regex Captured groups + # $1 = file + # $2 = reason + UI_FAILING_TEST_MATCHER = /^\s{4}t = \s+\d+\.\d+s\s+Assertion Failure: (.*:\d+): (.*)$/ + # @regex Captured groups # $1 = dsym GENERATE_DSYM_MATCHER = /^GenerateDSYMFile \/.*\/(.*\.dSYM)/ @@ -120,6 +125,12 @@ module Matchers # $3 = time PASSING_TEST_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/ + + # @regex Captured groups + # $1 = suite + # $2 = test_case + TEST_CASE_STARTED_MATCHER = /^Test Case '-\[(.*) (.*)\]' started.$/ + # @regex Captured groups # $1 = suite # $2 = test_case @@ -165,7 +176,7 @@ module Matchers # @regex Captured groups # $1 = suite # $2 = time - TESTS_RUN_START_MATCHER = /^\s*Test Suite '(?:.*\/)?(.*[ox]ctest.*)' started at(.*)/ + TEST_SUITE_STARTED_MATCHER = /^\s*Test Suite '(?:.*\/)?(.*[ox]ctest.*)' started at(.*)/ # @regex Captured groups # $1 test suite name @@ -339,6 +350,8 @@ def parse(text) formatter.format_error($1) when EXECUTED_MATCHER format_summary_if_needed(text) + when UI_FAILING_TEST_MATCHER + formatter.format_failing_test(@test_suite, @test_case, $2, $1) when FAILING_TEST_MATCHER formatter.format_failing_test($2, $3, $4, $1) when FATAL_ERROR_MATCHER @@ -379,7 +392,7 @@ def parse(text) formatter.format_pbxcp($1) when TESTS_RUN_COMPLETION_MATCHER formatter.format_test_run_finished($1, $3) - when TESTS_RUN_START_MATCHER + when TEST_SUITE_STARTED_MATCHER formatter.format_test_run_started($1) when TEST_SUITE_START_MATCHER formatter.format_test_suite_started($1) @@ -406,14 +419,19 @@ def parse(text) def update_test_state(text) case text - when TESTS_RUN_START_MATCHER + when TEST_CASE_STARTED_MATCHER + @test_suite = $1 + @test_case = $2 + when TEST_SUITE_STARTED_MATCHER @tests_done = false @formatted_summary = false @failures = {} when TESTS_RUN_COMPLETION_MATCHER @tests_done = true when FAILING_TEST_MATCHER - store_failure($1, $2, $3, $4) + store_failure(file: $1, test_suite: $2, test_case: $3, reason: $4) + when UI_FAILING_TEST_MATCHER + store_failure(file: $1, test_suite: @test_suite, test_case: @test_case, reason: $2) end end @@ -531,7 +549,7 @@ def reset_linker_format_state @formatting_linker_failure = false end - def store_failure(file, test_suite, test_case, reason) + def store_failure(file = nil, test_suite = nil, test_case = nil, reason = nil) failures_per_suite[test_suite] ||= [] failures_per_suite[test_suite] << { file_path: file, diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index a5e4f81c..a2580ba6 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -17,6 +17,36 @@ SAMPLE_OCUNIT_SUITE_COMPLETION = "Test Suite '/Users/musalj/Library/Developer/Xcode/DerivedData/ReactiveCocoa-eznxkbqvgfsnrvetemqloysuwagb/Build/Products/Test/ReactiveCocoaTests.octest(Tests)' finished at 2013-12-08 22:09:37 +0000." SAMPLE_XCTEST_SUITE_COMPLETION = "Test Suite 'ObjectiveSugarTests.xctest' finished at 2013-12-09 04:42:13 +0000." +SAMPLE_UITEST_CASE_WITH_FAILURE = %Q(\ +Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' started. + t = 0.00s Start Test at 2016-08-18 09:07:17.822 + t = 0.00s Set Up + t = 0.00s Launch com.vmware.horizon + t = 1.38s Wait for app to idle +Wait for connect to desktop done + t = 19.06s Snapshot accessibility hierarchy for com.vmware.horizon + t = 20.31s Find: Descendants matching type Window + t = 20.32s Find: Elements matching predicate '"rdsh1" IN identifiers' +Connect to desktop done + t = 20.32s Click "Disconnect" Button + t = 20.32s Wait for app to idle + t = 20.39s Find the "Disconnect" Button + t = 20.39s Snapshot accessibility hierarchy for com.vmware.horizon + t = 20.53s Find: Descendants matching type Window + t = 20.53s Find: Elements matching predicate '"rdsh1" IN identifiers' + t = 21.54s Find the "Disconnect" Button (retry 1) + t = 21.54s Snapshot accessibility hierarchy for com.vmware.horizon + t = 21.80s Find: Descendants matching type Window + t = 21.80s Find: Elements matching predicate '"rdsh1" IN identifiers' + t = 21.81s Find: Descendants matching type Toolbar + t = 21.81s Find: Descendants matching type Button + t = 21.81s Find: Elements matching predicate '"Disconnect" IN identifiers' + t = 21.81s Synthesize event + t = 22.27s Assertion Failure: :0: UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect' + t = 22.29s Tear Down +Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' failed (22.490 seconds). +) +SAMPLE_XCTEST_FAILURE = "" SAMPLE_KIWI_FAILURE = "/Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSNumberTests.m:49: error: -[NumberAdditions Iterators_TimesIteratesTheExactNumberOfTimes] : 'Iterators, times: iterates the exact number of times' [FAILED], expected subject to equal 4, got 5" SAMPLE_OLD_SPECTA_FAILURE = "/Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458: error: -[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES] : expected: 1, got: 0" SAMPLE_SPECTA_FAILURE = " Test Case '-[SKWelcomeViewControllerSpecSpec SKWelcomeViewController_When_a_user_opens_the_app_from_a_clean_installation_displays_the_welcome_screen]' started. \n/Users/vickeryj/Code/ipad-register/KIFTests/Specs/SKWelcomeViewControllerSpec.m:11: error: -[SKWelcomeViewControllerSpecSpec SKWelcomeViewController_When_a_user_opens_the_app_from_a_clean_installation_displays_the_welcome_screen] : The step timed out after 2.00 seconds: Failed to find accessibility element with the label \"The asimplest way to make smarter business decisions\"" diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 3351bd5a..e4e83278 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -168,6 +168,16 @@ module XCPretty @parser.parse(SAMPLE_LIBTOOL) end + it "parses uitest failing tests" do + @formatter.should receive(:format_failing_test).with( + "viewUITests.vmtAboutWindow", + "testConnectToDesktop", + "UI Testing Failure - Unable to find hit point for element Button 0x608001165880: {{74.0, -54.0}, {44.0, 38.0}}, label: 'Disconnect'", + ":0" + ) + @parser.parse(SAMPLE_UITEST_CASE_WITH_FAILURE) + end + it "parses specta failing tests" do @formatter.should receive(:format_failing_test).with("SKWelcomeViewControllerSpecSpec", "SKWelcomeViewController_When_a_user_opens_the_app_from_a_clean_installation_displays_the_welcome_screen", From aca791dee7e974f9f5357ebfee1e381d00e71952 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 22:57:44 -0700 Subject: [PATCH 33/61] how do i keyword parameters --- lib/xcpretty/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 72c1d3b8..0fe9d705 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -549,7 +549,7 @@ def reset_linker_format_state @formatting_linker_failure = false end - def store_failure(file = nil, test_suite = nil, test_case = nil, reason = nil) + def store_failure(file: nil, test_suite: nil, test_case: nil, reason: nil) failures_per_suite[test_suite] ||= [] failures_per_suite[test_suite] << { file_path: file, From 7dd0faf6d87dc471cbd332a5ae8d0fa9d4ed7f53 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 22:58:24 -0700 Subject: [PATCH 34/61] naming consistency --- lib/xcpretty/parser.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 0fe9d705..68af374d 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -123,7 +123,7 @@ module Matchers # $1 = suite # $2 = test_case # $3 = time - PASSING_TEST_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/ + TEST_CASE_PASSED_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/ # @regex Captured groups @@ -134,13 +134,13 @@ module Matchers # @regex Captured groups # $1 = suite # $2 = test_case - PENDING_TEST_MATCHER = /^Test Case\s'-\[(.*)\s(.*)PENDING\]'\spassed/ + TEST_CASE_PENDING_MATCHER = /^Test Case\s'-\[(.*)\s(.*)PENDING\]'\spassed/ # @regex Captured groups # $1 = suite # $2 = test_case # $3 = time - MEASURING_TEST_MATCHER = /^[^:]*:[^:]*:\sTest Case\s'-\[(.*)\s(.*)\]'\smeasured\s\[Time,\sseconds\]\saverage:\s(\d*\.\d{3}),/ + TEST_CASE_MEASURED_MATCHER = /^[^:]*:[^:]*:\sTest Case\s'-\[(.*)\s(.*)\]'\smeasured\s\[Time,\sseconds\]\saverage:\s(\d*\.\d{3}),/ PHASE_SUCCESS_MATCHER = /^\*\*\s(.*)\sSUCCEEDED\s\*\*/ @@ -368,11 +368,11 @@ def parse(text) formatter.format_libtool($1) when LINKING_MATCHER formatter.format_linking($1, $2, $3) - when MEASURING_TEST_MATCHER + when TEST_CASE_MEASURED_MATCHER formatter.format_measuring_test($1, $2, $3) - when PENDING_TEST_MATCHER + when TEST_CASE_PENDING_MATCHER formatter.format_pending_test($1, $2) - when PASSING_TEST_MATCHER + when TEST_CASE_PASSED_MATCHER formatter.format_passing_test($1, $2, $3) when PODS_ERROR_MATCHER formatter.format_error($1) @@ -419,13 +419,13 @@ def parse(text) def update_test_state(text) case text - when TEST_CASE_STARTED_MATCHER - @test_suite = $1 - @test_case = $2 when TEST_SUITE_STARTED_MATCHER @tests_done = false @formatted_summary = false @failures = {} + when TEST_CASE_STARTED_MATCHER + @test_suite = $1 + @test_case = $2 when TESTS_RUN_COMPLETION_MATCHER @tests_done = true when FAILING_TEST_MATCHER From 48162e3d6c148102906e429d6caf6fc7349a83d4 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 17:16:42 -0700 Subject: [PATCH 35/61] Force rspec 2.9. I just deleted the rant in commit message, but ping me personally if you're wondering why. --- .gitignore | 1 + .travis.yml | 7 +++--- Makefile | 14 ++++++++++++ Rakefile | 26 ---------------------- lib/xcpretty/reporters/reporter.rb | 3 ++- spec/xcpretty/formatters/formatter_spec.rb | 4 ++-- spec/xcpretty/reporters/reporter_spec.rb | 6 ++--- xcpretty.gemspec | 2 +- 8 files changed, 27 insertions(+), 36 deletions(-) create mode 100644 Makefile delete mode 100644 Rakefile diff --git a/.gitignore b/.gitignore index cd889a05..b088c21a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.gem *.rbc .bundle +.vendor .config .yardoc .rspec diff --git a/.travis.yml b/.travis.yml index 7f3782cc..84c6f710 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ language: ruby sudo: false -install: - - bundle install rvm: - 2.1.1 - 2.0.0 -script: rake ci +script: + - make spec + - make cucumber + - make lint diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..71691dc2 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +.PHONY: kick spec cucumber lint + +kick: + bundle exec kicker -r ruby + + +spec: + bundle exec rspec --color --format=doc + +cucumber: + bundle exec cucumber + +lint: + bundle exec rubocop diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 560a561f..00000000 --- a/Rakefile +++ /dev/null @@ -1,26 +0,0 @@ -require "bundler/gem_tasks" -require 'rubocop/rake_task' -require 'rspec/core/rake_task' -require 'cucumber/rake/task' - -task :kick do - sh 'bundle exec kicker -r ruby' -end - -Cucumber::Rake::Task.new(:cucumber) do |task| -end - -RSpec::Core::RakeTask.new(:spec) do |task| - task.rspec_opts = %w(--color --format=doc) -end - -RuboCop::RakeTask.new(:lint) do |task| - task.fail_on_error = false -end - -task :ci do - Rake::Task[:spec].invoke - Rake::Task[:cucumber].invoke - Rake::Task[:lint].invoke -end - diff --git a/lib/xcpretty/reporters/reporter.rb b/lib/xcpretty/reporters/reporter.rb index b9112c33..e03d8cdc 100644 --- a/lib/xcpretty/reporters/reporter.rb +++ b/lib/xcpretty/reporters/reporter.rb @@ -50,7 +50,8 @@ def write_report File.open(@filepath, 'w') do |f| # WAT: get rid of these locals. BTW Cucumber fails if you remove them output_string = @tests.join("\n") - output_string += "\nFINISHED RUNNING #{@test_count} TESTS WITH #{@fail_count} FAILURES" + output_string += + "\nFINISHED RUNNING #{@test_count} TESTS WITH #{@fail_count} FAILURES" f.write output_string end end diff --git a/spec/xcpretty/formatters/formatter_spec.rb b/spec/xcpretty/formatters/formatter_spec.rb index 06f1920f..da638bf3 100644 --- a/spec/xcpretty/formatters/formatter_spec.rb +++ b/spec/xcpretty/formatters/formatter_spec.rb @@ -12,11 +12,11 @@ module XCPretty end it "initializes with unicode" do - @formatter.use_unicode?.should be_truthy + @formatter.use_unicode?.should == true end it "initializes with color" do - @formatter.colorize?.should be_truthy + @formatter.colorize?.should == true end it "outputs to new lines by default" do diff --git a/spec/xcpretty/reporters/reporter_spec.rb b/spec/xcpretty/reporters/reporter_spec.rb index c007f31e..0cd86287 100644 --- a/spec/xcpretty/reporters/reporter_spec.rb +++ b/spec/xcpretty/reporters/reporter_spec.rb @@ -13,17 +13,17 @@ module XCPretty it "reports a passing test" do @reporter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001") - expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") + @reporter.tests.should include("_tupleByAddingObject__should_add_a_non_nil_object PASSED") end it "reports a failing test" do @reporter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file') - expect(@reporter.tests).to include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") + @reporter.tests.should include("enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES in path/to/file FAILED: expected: 1, got: 0") end it "reports a pending test" do @reporter.format_pending_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object") - expect(@reporter.tests).to include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") + @reporter.tests.should include("_tupleByAddingObject__should_add_a_non_nil_object IS PENDING") end it "writes to disk" do diff --git a/xcpretty.gemspec b/xcpretty.gemspec index 5f30feb9..95a73cd2 100644 --- a/xcpretty.gemspec +++ b/xcpretty.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rubocop", "~> 0.34.0" - spec.add_development_dependency "rspec", "~> 2.0" + spec.add_development_dependency "rspec", "2.99.0" spec.add_development_dependency "cucumber", "~> 1.0" end From 5baa33da7a37470038ea507608e2a61072656083 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 20:05:29 -0700 Subject: [PATCH 36/61] remove rake --- xcpretty.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/xcpretty.gemspec b/xcpretty.gemspec index 95a73cd2..d4d8fea3 100644 --- a/xcpretty.gemspec +++ b/xcpretty.gemspec @@ -29,7 +29,6 @@ Gem::Specification.new do |spec| spec.add_dependency 'rouge', '~> 1.8' spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" spec.add_development_dependency "rubocop", "~> 0.34.0" spec.add_development_dependency "rspec", "2.99.0" spec.add_development_dependency "cucumber", "~> 1.0" From 54205bbcd8e0ab32d6a4f05a51733832b3db12d8 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 23:24:51 -0700 Subject: [PATCH 37/61] fix lint --- features/steps/formatting_steps.rb | 1 + spec/fixtures/constants.rb | 1 + spec/xcpretty/formatters/formatter_spec.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index 67be0bba..af9d976b 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -367,3 +367,4 @@ Then(/^I should see the code signing is requried message$/) do run_output.should include("Code signing is required for product type 'Application' in SDK 'iOS 10.0'") end + diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index a2580ba6..81f11f46 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -654,3 +654,4 @@ ) SAMPLE_WILL_NOT_BE_CODE_SIGNED = "FrameworkName will not be code signed because its settings don't specify a development team." + diff --git a/spec/xcpretty/formatters/formatter_spec.rb b/spec/xcpretty/formatters/formatter_spec.rb index da638bf3..a00df492 100644 --- a/spec/xcpretty/formatters/formatter_spec.rb +++ b/spec/xcpretty/formatters/formatter_spec.rb @@ -141,3 +141,4 @@ module XCPretty end end end + From 2eae807f0ccaf723af910a69b3cb3c0709eee7fa Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 23:45:14 -0700 Subject: [PATCH 38/61] restart jobs From f52a62d483d4e9a566a63c488aaaef62f100c8df Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 23:46:51 -0700 Subject: [PATCH 39/61] bump version 0.2.4 --- lib/xcpretty/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index 442526bf..9b7883c5 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.3" + VERSION = "0.2.4" end From fa95f62c8be2364aea48ad5751e5d15711778bc7 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 10 Oct 2016 23:51:38 -0700 Subject: [PATCH 40/61] return back Rakefile turns out we need it for gem release... --- .travis.yml | 6 +++--- Makefile | 14 -------------- Rakefile | 17 +++++++++++++++++ xcpretty.gemspec | 1 + 4 files changed, 21 insertions(+), 17 deletions(-) delete mode 100644 Makefile create mode 100644 Rakefile diff --git a/.travis.yml b/.travis.yml index 84c6f710..1fdca27c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ rvm: - 2.0.0 script: - - make spec - - make cucumber - - make lint + - rake spec + - rake cucumber + - rake lint diff --git a/Makefile b/Makefile deleted file mode 100644 index 71691dc2..00000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.PHONY: kick spec cucumber lint - -kick: - bundle exec kicker -r ruby - - -spec: - bundle exec rspec --color --format=doc - -cucumber: - bundle exec cucumber - -lint: - bundle exec rubocop diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..988a57c9 --- /dev/null +++ b/Rakefile @@ -0,0 +1,17 @@ +require 'bundler/gem_tasks' + +task :kick do + sh 'bundle exec kicker -r ruby' +end + +task :spec do + sh 'bundle exec rspec --color --format=doc' +end + +task :cucumber do + sh 'bundle exec cucumber' +end + +task :lint do + sh 'bundle exec rubocop' +end diff --git a/xcpretty.gemspec b/xcpretty.gemspec index d4d8fea3..95a73cd2 100644 --- a/xcpretty.gemspec +++ b/xcpretty.gemspec @@ -29,6 +29,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'rouge', '~> 1.8' spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "rake" spec.add_development_dependency "rubocop", "~> 0.34.0" spec.add_development_dependency "rspec", "2.99.0" spec.add_development_dependency "cucumber", "~> 1.0" From de74a1d555f97424ecd768b03149e764a2fdc6ef Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Tue, 11 Oct 2016 07:16:17 -0700 Subject: [PATCH 41/61] dpn't print empty snippets --- lib/xcpretty/formatters/formatter.rb | 6 ++--- spec/xcpretty/formatters/formatter_spec.rb | 30 +++++++++++++--------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index dbd8aa33..cdd9380e 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -167,10 +167,10 @@ def format_failures(failures_per_suite) def format_failure(f) snippet = Snippet.from_filepath(f[:file_path]) + output = " #{f[:test_case]}, #{red(f[:reason])}" + return output if snippet.contents.empty? - output = " #{f[:test_case]}, #{red(f[:reason])}\n " \ - "#{cyan(f[:file_path])}\n ```\n" - + output += "\n #{cyan(f[:file_path])}\n ```\n" if @colorize output += Syntax.highlight(snippet) else diff --git a/spec/xcpretty/formatters/formatter_spec.rb b/spec/xcpretty/formatters/formatter_spec.rb index a00df492..8d7cf911 100644 --- a/spec/xcpretty/formatters/formatter_spec.rb +++ b/spec/xcpretty/formatters/formatter_spec.rb @@ -103,18 +103,21 @@ module XCPretty second_path = File.expand_path('spec/fixtures/NSStringTests.m:57') failures = { - 'CarSpec' => [ - { - file_path: first_path, - reason: "just doesn't work", - test_case: 'Starting the car' - }], - 'StringSpec' => [ - { - file_path: second_path, - reason: "doesn't split", - test_case: 'Splitting the string' - }] + 'CarSpec' => [{ + file_path: first_path, + reason: "just doesn't work", + test_case: 'Starting the car' + }], + 'StringSpec' => [{ + file_path: second_path, + reason: "doesn't split", + test_case: 'Splitting the string' + }], + 'UI spec' => [{ + file_path: ":0", + reason: "ui test failed", + test_case: 'yolo' + }] } @formatter.format_test_summary(SAMPLE_EXECUTED_TESTS, failures).should == %Q( @@ -136,6 +139,9 @@ module XCPretty }); ``` +UI spec + yolo, #{@formatter.red("ui test failed")} + #{@formatter.red(SAMPLE_EXECUTED_TESTS)}) end From fb3afc6f4495fa89c2dcb351b274eacb74595285 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Tue, 11 Oct 2016 07:16:50 -0700 Subject: [PATCH 42/61] bump 0.2.5 --- lib/xcpretty/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index 9b7883c5..8375d09f 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.4" + VERSION = "0.2.5" end From ba8fd7d82f15fbe70eb07138218cfb64fcb4ca46 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Sun, 23 Oct 2016 22:14:16 -0700 Subject: [PATCH 43/61] Update LICENSE.txt --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 16fdc227..1a00bbff 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013 Marin Usalj +Copyright (c) 2013-2016 Marin Usalj MIT License From 9ae6c0eeb18cd1a54b0637b2bb60340405d38c95 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Tue, 7 Feb 2017 00:54:33 -0800 Subject: [PATCH 44/61] fix empty snippet implementation --- features/simple_format.feature | 2 +- lib/xcpretty/formatters/formatter.rb | 3 ++- spec/xcpretty/formatters/formatter_spec.rb | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/features/simple_format.feature b/features/simple_format.feature index 5b7c8190..1ca731b1 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -225,4 +225,4 @@ Feature: Showing build output in simple format Scenario: Showing code signing is required error Given the target requires code signing When I pipe to xcpretty with "--simple --no-color" - Then I should see the code signing is requried message \ No newline at end of file + Then I should see the code signing is requried message diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index cdd9380e..a6fc1c65 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -168,9 +168,10 @@ def format_failures(failures_per_suite) def format_failure(f) snippet = Snippet.from_filepath(f[:file_path]) output = " #{f[:test_case]}, #{red(f[:reason])}" + output += "\n #{cyan(f[:file_path])}" return output if snippet.contents.empty? - output += "\n #{cyan(f[:file_path])}\n ```\n" + output += "\n ```\n" if @colorize output += Syntax.highlight(snippet) else diff --git a/spec/xcpretty/formatters/formatter_spec.rb b/spec/xcpretty/formatters/formatter_spec.rb index 8d7cf911..26935c92 100644 --- a/spec/xcpretty/formatters/formatter_spec.rb +++ b/spec/xcpretty/formatters/formatter_spec.rb @@ -141,6 +141,7 @@ module XCPretty UI spec yolo, #{@formatter.red("ui test failed")} + #{@formatter.cyan(":0")} #{@formatter.red(SAMPLE_EXECUTED_TESTS)}) From 70e262d01b0d2fad56a79a1f7ff71a865b9bb922 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Tue, 7 Feb 2017 00:59:57 -0800 Subject: [PATCH 45/61] =?UTF-8?q?add=20trailing=20blank=20line=20in=20Rake?= =?UTF-8?q?file=20=C2=AF\=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 988a57c9..18715863 100644 --- a/Rakefile +++ b/Rakefile @@ -15,3 +15,4 @@ end task :lint do sh 'bundle exec rubocop' end + From 50351414e7f3fcd06954a862c42f6d07624bb0fa Mon Sep 17 00:00:00 2001 From: Maksym Grebenets Date: Sun, 22 Jan 2017 00:42:19 +1100 Subject: [PATCH 46/61] Add matcher for 'No profile matching 'TargetName' found:' dependency error --- features/simple_format.feature | 5 +++++ features/steps/formatting_steps.rb | 8 ++++++++ lib/xcpretty/parser.rb | 6 ++++++ spec/fixtures/constants.rb | 4 ++++ spec/xcpretty/parser_spec.rb | 7 +++++++ 5 files changed, 30 insertions(+) diff --git a/features/simple_format.feature b/features/simple_format.feature index 1ca731b1..f935a3a7 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -226,3 +226,8 @@ Feature: Showing build output in simple format Given the target requires code signing When I pipe to xcpretty with "--simple --no-color" Then I should see the code signing is requried message + + Scenario: Showing no profile matching error + Given the matching profile is missing + When I pipe to xcpretty with "--simple --no-color" + Then I should see the no profile matching message diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index af9d976b..4c248926 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -144,6 +144,10 @@ add_run_input SAMPLE_CODE_SIGNING_IS_REQUIRED_ERROR end +Given(/^the matching profile is missing$/) do + add_run_input SAMPLE_NO_PROFILE_MATCHING_ERROR +end + Then(/^I should see a "(\w+)" completion message$/) do |phase| run_output.should start_with("▸ #{phase.capitalize} Succeeded") end @@ -368,3 +372,7 @@ run_output.should include("Code signing is required for product type 'Application' in SDK 'iOS 10.0'") end +Then(/^I should see the no profile matching message$/) do + run_output.should include("No profile matching 'TargetName' found: Xcode couldn't find a profile matching 'TargetName'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor.") +end + diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 740c5d71..79d2329f 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -230,6 +230,10 @@ module Errors # $1 = whole error CODE_SIGNING_REQUIRED_MATCHER = /^(Code signing is required for product type .* in SDK .*)$/ + # @regex Captured groups + # #1 = whole error + NO_PROFILE_MATCHING_MATCHER = /^(No profile matching .* found:.*)$/ + # @regex Captured groups # $1 = file_path # $2 = file_name @@ -332,6 +336,8 @@ def parse(text) formatter.format_error($1) when CODE_SIGNING_REQUIRED_MATCHER formatter.format_error($1) + when NO_PROFILE_MATCHING_MATCHER + formatter.format_error($1) when COMPILE_MATCHER formatter.format_compile($2, $1) when COMPILE_COMMAND_MATCHER diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index 81f11f46..7a7f9c48 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -641,6 +641,10 @@ Code signing is required for product type 'Application' in SDK 'iOS 10.0' ) +SAMPLE_NO_PROFILE_MATCHING_ERROR = %Q( +No profile matching 'TargetName' found: Xcode couldn't find a profile matching 'TargetName'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor. +) + ################################################################################ # WARNINGS ################################################################################ diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index e4e83278..33350e78 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -452,6 +452,13 @@ module XCPretty @parser.parse(SAMPLE_CODESIGN_ERROR_NO_SPACES) end + it "parses No profile matching error:" do + @formatter.should receive(:format_error).with( + "No profile matching 'TargetName' found: Xcode couldn't find a profile matching 'TargetName'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor." + ) + @parser.parse(SAMPLE_NO_PROFILE_MATCHING_ERROR) + end + it "parses ld library errors" do @formatter.should receive(:format_error).with( SAMPLE_LD_LIBRARY_ERROR From ce6579d2baa6cfb92b636215b0c13ce2da6eec01 Mon Sep 17 00:00:00 2001 From: Matt Cotton Date: Tue, 14 Feb 2017 18:50:11 +0000 Subject: [PATCH 47/61] Fix Screenshots (#269) * Parse screenshot name to better match against suite name * fix potential crash on empty array * remove whitespace * Fix whitespace again * Fix all whitespace ever --- lib/xcpretty/reporters/html.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/xcpretty/reporters/html.rb b/lib/xcpretty/reporters/html.rb index 568f579c..986cbdad 100644 --- a/lib/xcpretty/reporters/html.rb +++ b/lib/xcpretty/reporters/html.rb @@ -70,7 +70,10 @@ def load_screenshots Dir.foreach(SCREENSHOT_DIR) do |item| next if item == '.' || item == '..' || File.extname(item) != '.png' - suite_name = find_test_suite(item) + suite = item.split(".") + next if suite.empty? + + suite_name = find_test_suite(suite[0]) next if suite_name.nil? @test_suites[suite_name][:screenshots] << item From 7b2d76bc61da777e4e659b0b4f02e5a75c9ffc6e Mon Sep 17 00:00:00 2001 From: Matt Cotton Date: Tue, 21 Mar 2017 17:56:54 +0000 Subject: [PATCH 48/61] Improve Screenshot Matching (#270) * Parse screenshot name to better match against suite name * fix potential crash on empty array * remove whitespace * Fix whitespace again * Fix all whitespace ever * Improve screenshot matching against Test Suites with namespaces --- lib/xcpretty/reporters/html.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/reporters/html.rb b/lib/xcpretty/reporters/html.rb index 986cbdad..004719ba 100644 --- a/lib/xcpretty/reporters/html.rb +++ b/lib/xcpretty/reporters/html.rb @@ -82,7 +82,7 @@ def load_screenshots def find_test_suite(image_name) @test_suites.each do |key, value| - return key if image_name.start_with?(key) + return key if image_name.start_with?(key.split('.').last) end nil end From 25b9709593ac7347e7b240bf91e32ef3ff6403a0 Mon Sep 17 00:00:00 2001 From: Dimitar Kerezov Date: Wed, 22 Mar 2017 20:15:45 +0200 Subject: [PATCH 49/61] Improve Code sign error checking (#249) * Improve Code sign error checking * Optimize parser by reducing the number of separate regular expressions * Add Swift errors in Check dependencies phase --- lib/xcpretty/parser.rb | 20 +++++++------------- spec/fixtures/constants.rb | 12 ++++++++++++ spec/xcpretty/parser_spec.rb | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 79d2329f..2191d962 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -224,15 +224,15 @@ module Errors # @regex Captured groups # $1 = whole error - CODESIGN_ERROR_MATCHER = /^(Code\s?Sign error:.*)$/ + CHECK_DEPENDENCIES_ERRORS_MATCHER = /^(Code\s?Sign error:.*|Code signing is required for product type .* in SDK .*|No profile matching .* found:.*|Provisioning profile .* doesn't .*|Swift is unavailable on .*|.?Use Legacy Swift Language Version.*)$/ # @regex Captured groups # $1 = whole error - CODE_SIGNING_REQUIRED_MATCHER = /^(Code signing is required for product type .* in SDK .*)$/ + PROVISIONING_PROFILE_REQUIRED_MATCHER = /^(.*requires a provisioning profile.*)$/ # @regex Captured groups - # #1 = whole error - NO_PROFILE_MATCHING_MATCHER = /^(No profile matching .* found:.*)$/ + # $1 = whole error + NO_CERTIFICATE_MATCHER = /^(No certificate matching.*)$/ # @regex Captured groups # $1 = file_path @@ -244,10 +244,6 @@ module Errors # $1 cursor (with whitespaces and tildes) CURSOR_MATCHER = /^([\s~]*\^[\s~]*)$/ - # @regex Captured groups - # $1 = whole message - PROFILE_DOESNT_SUPPORT_OR_INCLUDE = /^(Provisioning profile .* doesn't .*)$/ - # @regex Captured groups # $1 = whole error. # it varies a lot, not sure if it makes sense to catch everything separately @@ -332,11 +328,11 @@ def parse(text) formatter.format_codesign($1) when CODESIGN_MATCHER formatter.format_codesign($1) - when CODESIGN_ERROR_MATCHER + when CHECK_DEPENDENCIES_ERRORS_MATCHER formatter.format_error($1) - when CODE_SIGNING_REQUIRED_MATCHER + when PROVISIONING_PROFILE_REQUIRED_MATCHER formatter.format_error($1) - when NO_PROFILE_MATCHING_MATCHER + when NO_CERTIFICATE_MATCHER formatter.format_error($1) when COMPILE_MATCHER formatter.format_compile($2, $1) @@ -352,8 +348,6 @@ def parse(text) formatter.format_copy_plist_file($1, $2) when CPRESOURCE_MATCHER formatter.format_cpresource($1) - when PROFILE_DOESNT_SUPPORT_OR_INCLUDE - formatter.format_error($1) when EXECUTED_MATCHER format_summary_if_needed(text) when UI_FAILING_TEST_MATCHER diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index 7a7f9c48..b94afe9a 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -582,6 +582,14 @@ CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.0' ) +SAMPLE_REQUIRES_PROVISION = %Q( +PROJECT_NAME requires a provisioning profile. Select a provisioning profile for the "Debug" build configuration in the project editor. +) + +SAMPLE_NO_CERTIFICATE = %Q( +No certificate matching 'iPhone Distribution: Name (B89SBB0AV9)' for team 'B89SBB0AV9': Select a different signing certificate for CODE_SIGN_IDENTITY, a team that matches your selected certificate, or switch to automatic provisioning. +) + SAMPLE_FATAL_COMPILE_ERROR = %Q( In file included from /Users/musalj/code/OSS/SampleApp/Pods/SuperCoolPod/SuperAwesomeClass.m:12: In file included from /Users/musalj/code/OSS/SampleApp/Pods/../LessCoolPod/LessCoolClass.h:9: @@ -645,6 +653,10 @@ No profile matching 'TargetName' found: Xcode couldn't find a profile matching 'TargetName'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor. ) +SAMPLE_SWIFT_UNAVAILABLE = "Swift is unavailable on iOS earlier than 7.0; please set IPHONEOS_DEPLOYMENT_TARGET to 7.0 or later (currently it is '6.0')." + +SAMPLE_USE_LEGACY_SWIFT = "“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly." + ################################################################################ # WARNINGS ################################################################################ diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 33350e78..d9db10fd 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -459,6 +459,34 @@ module XCPretty @parser.parse(SAMPLE_NO_PROFILE_MATCHING_ERROR) end + it "parses requires provision error:" do + @formatter.should receive(:format_error).with( + 'PROJECT_NAME requires a provisioning profile. Select a provisioning profile for the "Debug" build configuration in the project editor.' + ) + @parser.parse(SAMPLE_REQUIRES_PROVISION) + end + + it "parses no certificate error:" do + @formatter.should receive(:format_error).with( + "No certificate matching 'iPhone Distribution: Name (B89SBB0AV9)' for team 'B89SBB0AV9': Select a different signing certificate for CODE_SIGN_IDENTITY, a team that matches your selected certificate, or switch to automatic provisioning." + ) + @parser.parse(SAMPLE_NO_CERTIFICATE) + end + + it "parses swift unavailable error:" do + @formatter.should receive(:format_error).with( + SAMPLE_SWIFT_UNAVAILABLE + ) + @parser.parse(SAMPLE_SWIFT_UNAVAILABLE) + end + + it "parses use legacy swift error:" do + @formatter.should receive(:format_error).with( + SAMPLE_USE_LEGACY_SWIFT + ) + @parser.parse(SAMPLE_USE_LEGACY_SWIFT) + end + it "parses ld library errors" do @formatter.should receive(:format_error).with( SAMPLE_LD_LIBRARY_ERROR From 422774d58e51b4ae7d53865b03d225283eed7f49 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Fri, 31 Mar 2017 10:28:11 -0700 Subject: [PATCH 50/61] update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aac84e9b..739b4bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.2.6 + +* Codesigning matchers improvements +* Screenshots parsing fixes + +###### Bug fixes + +* Fix reporers crash by default ld warning implementation + | [iKiKi](https://github.com/iKiKi) + | [#187](https://github.com/supermarin/xcpretty/pull/187) + ## 0.2.1 ###### Bug fixes From 57fe4ffe3a49ea51fa0cf29f0e5c6a2eead6e8e4 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Fri, 31 Mar 2017 10:36:38 -0700 Subject: [PATCH 51/61] bump version to 0.2.6 --- lib/xcpretty/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index 8375d09f..31fea20a 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.5" + VERSION = "0.2.6" end From d38e3143dae62780e563b4cd5837e96ccfeb60a0 Mon Sep 17 00:00:00 2001 From: Kohki Miki Date: Wed, 26 Apr 2017 03:21:00 +0900 Subject: [PATCH 52/61] Upgrade rouge (#277) --- xcpretty.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcpretty.gemspec b/xcpretty.gemspec index 95a73cd2..4179108a 100644 --- a/xcpretty.gemspec +++ b/xcpretty.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency 'rouge', '~> 1.8' + spec.add_dependency 'rouge', '~> 2.0.7' spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" From 8c3e0e228e858d1a793dd9352e71a95e340629d8 Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Thu, 27 Apr 2017 11:16:39 -0700 Subject: [PATCH 53/61] bump version to 0.2.7 --- lib/xcpretty/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index 31fea20a..a9b6cb09 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.6" + VERSION = "0.2.7" end From 7a072a1ec930ae3ab1b9ef4b8df5bc9a69ba0db0 Mon Sep 17 00:00:00 2001 From: Matt Cotton Date: Sat, 13 May 2017 00:03:39 +0100 Subject: [PATCH 54/61] Improve screenshot support (#280) * Display screenshots next to tests * Tidy report output * Fix report output hiding tests * Fix failing test * Add support for screenshots containing suite name * Fix failing test - had to shorten filename of screenshot * Fix rubocop issue --- assets/report.html.erb | 25 ++++++++-------- ...hould_send_YES_while_executing_is_YES.png} | Bin lib/xcpretty/reporters/html.rb | 28 ++++++++++-------- spec/fixtures/constants.rb | 4 +-- spec/xcpretty/parser_spec.rb | 2 +- 5 files changed, 31 insertions(+), 28 deletions(-) rename features/assets/{RACCommandSpec, line 80, hello xcpretty.png => RACCommandSpec_enabled_signal_should_send_YES_while_executing_is_YES.png} (100%) diff --git a/assets/report.html.erb b/assets/report.html.erb index ca26763e..50979c06 100644 --- a/assets/report.html.erb +++ b/assets/report.html.erb @@ -30,7 +30,8 @@ .test.passing { background-color: #CAF59F;} .test.failing.odd { background-color: #EEC7CC;} .test.passing.odd { background-color: #E5FBCF;} - .details { background-color: #F4DDE0; border: 1px solid #C84F5E;} + .details.failing { background-color: #F4DDE0; border: 1px solid #C84F5E;} + .details.passing { background-color: #E5F4DC; border: 1px solid #A1D761;} .test .test-detail:last-child { padding-bottom: 8px;} .test .title { float: left; font-size: 0.9em; margin-top: 8px; font-family: Menlo, Monaco, monospace;} .test .time { float: left;margin: 4px 10px 0 20px;} @@ -127,15 +128,6 @@

<%= name %>

- <% unless info[:screenshots].empty? %> -
- <% info[:screenshots].each_with_index do |screenshot, index| %> - - - - <% end %> -
- <% end %> <% info[:tests].each_with_index do |test, index| %> <% detail_class = test[:name].gsub(/\s/,'') %> @@ -147,8 +139,8 @@ - <% if test[:reason] || test[:snippet] %> - + <% if test[:reason] || test[:snippet] || !test[:screenshots].empty? %> + <% end %> diff --git a/features/assets/RACCommandSpec, line 80, hello xcpretty.png b/features/assets/RACCommandSpec_enabled_signal_should_send_YES_while_executing_is_YES.png similarity index 100% rename from features/assets/RACCommandSpec, line 80, hello xcpretty.png rename to features/assets/RACCommandSpec_enabled_signal_should_send_YES_while_executing_is_YES.png diff --git a/lib/xcpretty/reporters/html.rb b/lib/xcpretty/reporters/html.rb index 004719ba..5e304665 100644 --- a/lib/xcpretty/reporters/html.rb +++ b/lib/xcpretty/reporters/html.rb @@ -27,11 +27,12 @@ def handle(line) def format_failing_test(suite, test_case, reason, file) add_test(suite, name: test_case, failing: true, reason: reason, file: file, - snippet: formatted_snippet(file)) + snippet: formatted_snippet(file), + screenshots: []) end def format_passing_test(suite, test_case, time) - add_test(suite, name: test_case, time: time) + add_test(suite, name: test_case, time: time, screenshots: []) end private @@ -41,10 +42,9 @@ def formatted_snippet(filepath) Syntax.highlight_html(snippet) end - def add_test(suite_name, data) @test_count += 1 - @test_suites[suite_name] ||= {tests: [], screenshots: []} + @test_suites[suite_name] ||= {tests: []} @test_suites[suite_name][:tests] << data if data[:failing] @test_suites[suite_name][:failing] = true @@ -70,19 +70,21 @@ def load_screenshots Dir.foreach(SCREENSHOT_DIR) do |item| next if item == '.' || item == '..' || File.extname(item) != '.png' - suite = item.split(".") - next if suite.empty? - - suite_name = find_test_suite(suite[0]) - next if suite_name.nil? + test = find_test(item) + next if test.nil? - @test_suites[suite_name][:screenshots] << item + test[:screenshots] << item end end - def find_test_suite(image_name) - @test_suites.each do |key, value| - return key if image_name.start_with?(key.split('.').last) + def find_test(image_name) + @test_suites.each do |name, info| + info[:tests].each do |test, index| + combined_name = name + '_' + test[:name] + test_name_matches = image_name.start_with?(test[:name]) + combined_name_matches = image_name.start_with?(combined_name) + return test if test_name_matches || combined_name_matches + end end nil end diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index b94afe9a..3561940a 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -64,7 +64,7 @@ ) SAMPLE_EXECUTED_TESTS = "Executed 4 tests, with 0 failures (0 unexpected) in 0.003 (0.004) seconds" SAMPLE_SPECTA_EXECUTED_TESTS = " Executed 4 tests, with 0 failures (0 unexpected) in 10.192 (10.193) seconds" -SAMPLE_OCUNIT_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.001 seconds)." +SAMPLE_OCUNIT_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES]' passed (0.001 seconds)." SAMPLE_SPECTA_TEST = " Test Case '-[SKWelcomeActivationViewControllerSpecSpec SKWelcomeActivationViewController_When_a_user_enters_their_details_lets_them_enter_a_valid_manager_code]' passed (0.725 seconds)." SAMPLE_SLOWISH_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.026 seconds)." SAMPLE_SLOW_TEST = "Test Case '-[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES]' passed (0.101 seconds)." @@ -555,7 +555,7 @@ warning: skipping copy phase strip, binary is code signed: /Users/dustin/Source/CocoaChip/build/Release/CocoaChipCore.framework/Versions/A/CocoaChipCore ) -SAMPLE_SCREENSHOT_FILE = 'RACCommandSpec, line 80, hello xcpretty.png' +SAMPLE_SCREENSHOT_FILE = 'RACCommandSpec_enabled_signal_should_send_YES_while_executing_is_YES.png' SAMPLE_UNRELATED_IMAGE_FILE = 'apple_raw.png' ################################################################################ diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index d9db10fd..27474c9b 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -201,7 +201,7 @@ module XCPretty it "parses passing ocunit tests" do @formatter.should receive(:format_passing_test).with('RACCommandSpec', - 'enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES', + 'enabled_signal_should_send_YES_while_executing_is_YES', '0.001') @parser.parse(SAMPLE_OCUNIT_TEST) end From c5e2d1045f808687d32db96c55fc7e56ae38293b Mon Sep 17 00:00:00 2001 From: Sean Abraham Date: Mon, 15 May 2017 16:31:35 -0700 Subject: [PATCH 55/61] Add support for errors (#283) --- lib/xcpretty/parser.rb | 7 +++++++ spec/fixtures/constants.rb | 2 ++ spec/xcpretty/parser_spec.rb | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 2191d962..103e36ff 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -254,6 +254,7 @@ module Errors # $2 = file path FILE_MISSING_ERROR_MATCHER = /^:0:\s(error:\s.*)\s'(\/.+\/.*\..*)'$/ + # @regex Captured groups # $1 = whole error LD_ERROR_MATCHER = /^(ld:.*)/ @@ -280,6 +281,10 @@ module Errors # @regex Captured groups # $1 = reference SYMBOL_REFERENCED_FROM_MATCHER = /\s+"(.*)", referenced from:$/ + + # @regex Captured groups + # $1 = error reason + MODULE_INCLUDES_ERROR_MATCHER = /^\:.*?:.*?:\s(?:fatal\s)?(error:\s.*)$/ end end @@ -368,6 +373,8 @@ def parse(text) formatter.format_libtool($1) when LINKING_MATCHER formatter.format_linking($1, $2, $3) + when MODULE_INCLUDES_ERROR_MATCHER + formatter.format_error($1) when TEST_CASE_MEASURED_MATCHER formatter.format_measuring_test($1, $2, $3) when TEST_CASE_PENDING_MATCHER diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index 3561940a..cd2590e9 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -657,6 +657,8 @@ SAMPLE_USE_LEGACY_SWIFT = "“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly." +SAMPLE_MODULE_INCLUDES_ERROR = ":1:1: error: umbrella header for module 'ModuleName' does not include header 'Header.h'" + ################################################################################ # WARNINGS ################################################################################ diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 27474c9b..3b87c10c 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -523,6 +523,13 @@ module XCPretty @formatter.should receive(:format_error) @parser.parse(SAMPLE_CODE_SIGNING_IS_REQUIRED_ERROR) end + + it "parses module includes error" do + @formatter.should receive(:format_error).with( + "error: umbrella header for module 'ModuleName' does not include header 'Header.h'" + ) + @parser.parse(SAMPLE_MODULE_INCLUDES_ERROR) + end end context "warnings" do From 93b6f872c322d963b0ad399d67c9d638940baa5e Mon Sep 17 00:00:00 2001 From: Marin Usalj Date: Mon, 15 May 2017 16:44:57 -0700 Subject: [PATCH 56/61] bump version to 0.2.8 --- lib/xcpretty/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index a9b6cb09..2f28e3d6 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.7" + VERSION = "0.2.8" end From 87dd9f8fb5a230a1260a837c2fa424000f17d2e1 Mon Sep 17 00:00:00 2001 From: kenji21 Date: Tue, 5 Dec 2017 19:55:29 +0100 Subject: [PATCH 57/61] Fix 291 tests restarting when fatal error (#293) * Add a failing feature showing the issue * Add a matcher to mark test as failed when xcodebuild restarts testing. --- features/junit_report.feature | 5 +++++ features/steps/formatting_steps.rb | 4 ++++ lib/xcpretty/parser.rb | 7 +++++++ spec/fixtures/constants.rb | 24 ++++++++++++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/features/junit_report.feature b/features/junit_report.feature index d71f49dd..b1527694 100644 --- a/features/junit_report.feature +++ b/features/junit_report.feature @@ -42,3 +42,8 @@ Feature: Creating a JUnit test report Scenario: Writing to multiple custom file paths When I pipe to xcpretty with two custom "junit" report paths Then I should have test reports in two custom paths + + Scenario: Showing tests with one having a swift fatal error + Given I have a swift fatal error in a test in my suite + When I pipe to xcpretty with "--report junit" + Then I should see a failed test node in my report diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index 4c248926..c4c326cf 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -31,6 +31,10 @@ add_run_input SAMPLE_OLD_SPECTA_FAILURE end +Given(/^I have a swift fatal error in a test in my suite$/) do + add_run_input SAMPLE_SWIFT_FATAL_ERROR_IN_TEST_MAKE_TESTS_RESTARTING +end + Given(/^all of my tests will pass in my suite$/) do 3.times { add_run_input SAMPLE_OCUNIT_TEST } end diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 103e36ff..7dc867a5 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -105,6 +105,9 @@ module Matchers # $2 = reason UI_FAILING_TEST_MATCHER = /^\s{4}t = \s+\d+\.\d+s\s+Assertion Failure: (.*:\d+): (.*)$/ + # @regex Captured groups + RESTARTING_TESTS_MATCHER = /^Restarting after unexpected exit or crash in.+$/ + # @regex Captured groups # $1 = dsym GENERATE_DSYM_MATCHER = /^GenerateDSYMFile \/.*\/(.*\.dSYM)/ @@ -355,6 +358,8 @@ def parse(text) formatter.format_cpresource($1) when EXECUTED_MATCHER format_summary_if_needed(text) + when RESTARTING_TESTS_MATCHER + formatter.format_failing_test(@test_suite, @test_case, "Test crashed", "n/a") when UI_FAILING_TEST_MATCHER formatter.format_failing_test(@test_suite, @test_case, $2, $1) when FAILING_TEST_MATCHER @@ -439,6 +444,8 @@ def update_test_state(text) store_failure(file: $1, test_suite: $2, test_case: $3, reason: $4) when UI_FAILING_TEST_MATCHER store_failure(file: $1, test_suite: @test_suite, test_case: @test_case, reason: $2) + when RESTARTING_TESTS_MATCHER + store_failure(file: "n/a", test_suite: @test_suite, test_case: @test_case, reason: "Test crashed") end end diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index cd2590e9..fd587688 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -50,6 +50,30 @@ SAMPLE_KIWI_FAILURE = "/Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSNumberTests.m:49: error: -[NumberAdditions Iterators_TimesIteratesTheExactNumberOfTimes] : 'Iterators, times: iterates the exact number of times' [FAILED], expected subject to equal 4, got 5" SAMPLE_OLD_SPECTA_FAILURE = "/Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458: error: -[RACCommandSpec enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES] : expected: 1, got: 0" SAMPLE_SPECTA_FAILURE = " Test Case '-[SKWelcomeViewControllerSpecSpec SKWelcomeViewController_When_a_user_opens_the_app_from_a_clean_installation_displays_the_welcome_screen]' started. \n/Users/vickeryj/Code/ipad-register/KIFTests/Specs/SKWelcomeViewControllerSpec.m:11: error: -[SKWelcomeViewControllerSpecSpec SKWelcomeViewController_When_a_user_opens_the_app_from_a_clean_installation_displays_the_welcome_screen] : The step timed out after 2.00 seconds: Failed to find accessibility element with the label \"The asimplest way to make smarter business decisions\"" +SAMPLE_SWIFT_FATAL_ERROR_IN_TEST_MAKE_TESTS_RESTARTING = %Q(\ +Test Suite 'All tests' started at 2017-07-10 15:01:12.049 +Test Suite 'xcprettyFatalErrorTests.xctest' started at 2017-07-10 15:01:12.049 +Test Suite 'xcprettyFatalErrorTests' started at 2017-07-10 15:01:12.049 +Test Case '-[xcprettyFatalErrorTests.xcprettyFatalErrorTests testExample]' started. +Test Case '-[xcprettyFatalErrorTests.xcprettyFatalErrorTests testExample]' passed (0.001 seconds). +Test Case '-[xcprettyFatalErrorTests.xcprettyFatalErrorTests testFatalError]' started. +fatal error: unexpectedly found nil while unwrapping an Optional value + +Restarting after unexpected exit or crash in xcprettyFatalErrorTests/testFatalError(); summary will include totals from previous launches. + +Test Suite 'Selected tests' started at 2017-07-10 15:01:17.698 +Test Suite 'xcprettyFatalErrorTests.xctest' started at 2017-07-10 15:01:17.698 +Test Suite 'xcprettyFatalErrorTests' started at 2017-07-10 15:01:17.699 +Test Case '-[xcprettyFatalErrorTests.xcprettyFatalErrorTests testPerformanceExample]' started. +/Users/kenji/Desktop/xcprettyFatalError/xcprettyFatalErrorTests/xcprettyFatalErrorTests.swift:40: Test Case '-[xcprettyFatalErrorTests.xcprettyFatalErrorTests testPerformanceExample]' measured [Time, seconds] average: 0.000, relative standard deviation: 174.575%, values: [0.000005, 0.000001, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000], performanceMetricID:com.apple.XCTPerformanceMetric_WallClockTime, baselineName: "", baselineAverage: , maxPercentRegression: 10.000%, maxPercentRelativeStandardDeviation: 10.000%, maxRegression: 0.100, maxStandardDeviation: 0.100 +Test Case '-[xcprettyFatalErrorTests.xcprettyFatalErrorTests testPerformanceExample]' passed (0.258 seconds). +Test Suite 'xcprettyFatalErrorTests' failed at 2017-07-10 15:01:17.957. + Executed 3 tests, with 1 failure (0 unexpected) in 0.258 (0.259) seconds +Test Suite 'xcprettyFatalErrorTests.xctest' failed at 2017-07-10 15:01:17.958. + Executed 3 tests, with 1 failure (0 unexpected) in 0.258 (0.259) seconds +Test Suite 'Selected tests' failed at 2017-07-10 15:01:17.958. + Executed 3 tests, with 1 failure (0 unexpected) in 0.258 (0.260) seconds +) SAMPLE_BUILD = "=== BUILD TARGET The Spacer OF PROJECT Pods WITH THE DEFAULT CONFIGURATION Debug ===" SAMPLE_ANALYZE_TARGET = "=== ANALYZE TARGET The Spacer OF PROJECT Pods WITH THE DEFAULT CONFIGURATION Debug ===" From f140c5a1f1c6dca76ee44214f7a3d11444e934fb Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Wed, 25 Jul 2018 16:41:21 -0700 Subject: [PATCH 58/61] Add catch-all formatter (#327) * Add catch-all formatter * Fix linter warning * Add test for format_other --- lib/xcpretty/formatters/formatter.rb | 5 +++++ lib/xcpretty/parser.rb | 2 +- spec/fixtures/constants.rb | 1 + spec/xcpretty/parser_spec.rb | 7 +++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/xcpretty/formatters/formatter.rb b/lib/xcpretty/formatters/formatter.rb index a6fc1c65..548bdbe5 100644 --- a/lib/xcpretty/formatters/formatter.rb +++ b/lib/xcpretty/formatters/formatter.rb @@ -49,6 +49,7 @@ def format_touch(file_path, file_name); EMPTY; end def format_tiffutil(file); EMPTY; end def format_write_file(file); EMPTY; end def format_write_auxiliary_files; EMPTY; end + def format_other(text) EMPTY; end # COMPILER / LINKER ERRORS AND WARNINGS def format_compile_error(file_name, file_path, reason, @@ -152,6 +153,10 @@ def format_will_not_be_code_signed(message) "#{yellow(warning_symbol + " " + message)}" end + def format_other(text) + "" + end + private diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 7dc867a5..37a8f707 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -423,7 +423,7 @@ def parse(text) when WILL_NOT_BE_CODE_SIGNED_MATCHER formatter.format_will_not_be_code_signed($1) else - "" + formatter.format_other(text) end end diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index fd587688..0696ee1c 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -696,4 +696,5 @@ ) SAMPLE_WILL_NOT_BE_CODE_SIGNED = "FrameworkName will not be code signed because its settings don't specify a development team." +SAMPLE_FORMAT_OTHER_UNRECOGNIZED_STRING = "This is a string that won't be matched by any other regex." diff --git a/spec/xcpretty/parser_spec.rb b/spec/xcpretty/parser_spec.rb index 3b87c10c..8c76421a 100644 --- a/spec/xcpretty/parser_spec.rb +++ b/spec/xcpretty/parser_spec.rb @@ -361,6 +361,13 @@ module XCPretty @parser.parse(SAMPLE_SPECTA_SUITE_BEGINNING) end + it "parses unknown strings" do + @formatter.should receive(:format_other).with( + SAMPLE_FORMAT_OTHER_UNRECOGNIZED_STRING + ) + @parser.parse(SAMPLE_FORMAT_OTHER_UNRECOGNIZED_STRING) + end + context "errors" do it "parses clang errors" do @formatter.should receive(:format_error).with(SAMPLE_CLANG_ERROR) From 623146e95fb8dbba4d87eb4ba33e096d1e8ca318 Mon Sep 17 00:00:00 2001 From: Scott Albertson Date: Wed, 1 Aug 2018 16:59:53 -0700 Subject: [PATCH 59/61] Add a "Reviewed by Hound" badge (#331) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6680db24..269485f9 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ It does one thing, and it should do it well. [![Gem version](http://img.shields.io/gem/v/xcpretty.svg)](http://rubygems.org/gems/xcpretty) [![Build Status](https://travis-ci.org/supermarin/xcpretty.svg?branch=master)](https://travis-ci.org/supermarin/xcpretty) [![Code Climate](http://img.shields.io/codeclimate/github/supermarin/xcpretty.svg)](https://codeclimate.com/github/supermarin/xcpretty) +[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) ## Installation ``` bash From 1eb47d553ff6113070f999819f9eb9a4d11b9c72 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Thu, 16 Aug 2018 09:10:17 -0700 Subject: [PATCH 60/61] Allow clangs other than */bin/clang in compile commands Fixes #310 --- features/json_compilation_database_report.feature | 7 +++++++ features/simple_format.feature | 5 +++++ features/steps/formatting_steps.rb | 4 ++++ features/steps/json_steps.rb | 9 ++++++--- lib/xcpretty/parser.rb | 2 +- spec/fixtures/constants.rb | 7 +++++++ 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/features/json_compilation_database_report.feature b/features/json_compilation_database_report.feature index 6eaa7eb6..1c3b1578 100644 --- a/features/json_compilation_database_report.feature +++ b/features/json_compilation_database_report.feature @@ -7,6 +7,13 @@ Feature: Create a JSON compilation database Then the JSON compilation database should contain an entry with a directory Then the JSON compilation database should contain an entry with a file + Scenario: Showing file compilation with CCache + Given I have a file to compile with ccache + When I pipe to xcpretty with "--report json-compilation-database" and specify a custom path + Then the JSON compilation database should contain an entry with a command + Then the JSON compilation database should contain an entry with a directory + Then the JSON compilation database should contain an entry with a file + Scenario: Handling a complete xcodebuild session Given some big input When I pipe to xcpretty with "--report json-compilation-database" and specify a custom path diff --git a/features/simple_format.feature b/features/simple_format.feature index f935a3a7..5bc38cc8 100644 --- a/features/simple_format.feature +++ b/features/simple_format.feature @@ -5,6 +5,11 @@ Feature: Showing build output in simple format When I pipe to xcpretty with "--simple --no-color" Then I should see a successful compilation message + Scenario: Showing file compilation with CCache + Given I have a file to compile with ccache + When I pipe to xcpretty with "--simple --no-color" + Then I should see a successful compilation message + Scenario: Showing xib compilation Given I have a xib to compile When I pipe to xcpretty with "--simple --no-color" diff --git a/features/steps/formatting_steps.rb b/features/steps/formatting_steps.rb index c4c326cf..fc4fbd7b 100644 --- a/features/steps/formatting_steps.rb +++ b/features/steps/formatting_steps.rb @@ -3,6 +3,10 @@ add_run_input SAMPLE_COMPILE end +Given(/^I have a file to compile with ccache$/) do + add_run_input SAMPLE_COMPILE_CCACHE +end + Given(/^I have a xib to compile$/) do add_run_input SAMPLE_COMPILE_XIB end diff --git a/features/steps/json_steps.rb b/features/steps/json_steps.rb index 85b0e130..cd102a5c 100644 --- a/features/steps/json_steps.rb +++ b/features/steps/json_steps.rb @@ -18,16 +18,19 @@ Then(/^the JSON compilation database should contain an entry with a command$/) do json_db.length.should == 1 - json_db[0]['command'].should start_with('/Applications/Xcode.app/Contents/Developer') + json_db[0]['command'].should start_with('/') + json_db[0]['command'].should include('clang ') + json_db[0]['command'].should include(' -c ') + json_db[0]['command'].should include(' -o ') json_db[0]['command'].should end_with('.o') end Then(/^the JSON compilation database should contain an entry with a file$/) do - json_db[0]['file'].should == '/Users/musalj/code/OSS/ObjectiveSugar/Classes/NSMutableArray+ObjectiveSugar.m' + json_db[0]['file'].should end_with('.m') end Then(/^the JSON compilation database should contain an entry with a directory$/) do - json_db[0]['directory'].should == '/' + json_db[0]['directory'].should start_with('/') end Then(/^the JSON compilation database should be complete$/) do diff --git a/lib/xcpretty/parser.rb b/lib/xcpretty/parser.rb index 37a8f707..eb4e888d 100644 --- a/lib/xcpretty/parser.rb +++ b/lib/xcpretty/parser.rb @@ -60,7 +60,7 @@ module Matchers # @regex Captured groups # $1 compiler_command # $2 file_path - COMPILE_COMMAND_MATCHER = /^\s*(.*\/bin\/clang\s.*\s\-c\s(.*\.(?:m|mm|c|cc|cpp|cxx))\s.*\.o)$/ + COMPILE_COMMAND_MATCHER = /^\s*(.*clang\s.*\s\-c\s(.*\.(?:m|mm|c|cc|cpp|cxx))\s.*\.o)$/ # @regex Captured groups # $1 file_path diff --git a/spec/fixtures/constants.rb b/spec/fixtures/constants.rb index 0696ee1c..2e2210be 100644 --- a/spec/fixtures/constants.rb +++ b/spec/fixtures/constants.rb @@ -116,6 +116,13 @@ setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/musalj/code/go/bin:/Users/musalj/.rbenv/shims:/Users/musalj/.rbenv/bin:/usr/local/share/npm/bin:/usr/local/bin:/Library/Python/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=178 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=c99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wmissing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wnewline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=5.0 -iquote /Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Kiwi-generated-files.hmap -I/Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Kiwi-own-target-headers.hmap -I/Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Kiwi-all-target-headers.hmap -iquote /Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Kiwi-project-headers.hmap -I/Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/DerivedSources/i386 -I/Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/DerivedSources -Wall -F/Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -include /Users/musalj/code/OSS/Kiwi/Supporting\ Files/Kiwi-Prefix.pch -MMD -MT dependencies -MF /Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Objects-normal/i386/KWNull.d --serialize-diagnostics /Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Objects-normal/i386/KWNull.dia -c /Users/musalj/code/OSS/Kiwi/Classes/Core/KWNull.m -o /Users/musalj/Library/Developer/Xcode/DerivedData/Kiwi-guimpeiqlepzeaankpygesetdzsx/Build/Intermediates/Kiwi.build/Debug-iphonesimulator/Kiwi.build/Objects-normal/i386/KWNull.o ) +SAMPLE_COMPILE_CCACHE = %Q( +CompileC /Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato-DMMTodoTxt.build/Objects-normal/armv7/DMMTodoTxtParser.o DMMTodoTxt/Pod/Classes/DMMTodoTxtParser.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler + cd /Users/delisa/Code/personal/Gelato/Pods + export LANG=en_US.US-ASCII + export PATH="/Applications/Xcode/Xcode-9.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode/Xcode-9.3.app/Contents/Developer/usr/bin:/Users/delisa/.rbenv/shims:/Users/delisa/.pyenv/shims:/Users/delisa/.swiftenv/shims:/Users/delisa/bin:/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/usr/sbin:/sbin:/Users/delisa/tmp/go/bin:/Users/delisa/Library/Android/sdk/platform-tools/" + /Users/delisa/Code/personal/Gelato/ccache-clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/delisa/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/delisa/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fapplication-extension -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DRELEASE=1 -DCOCOAPODS=1 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode/Xcode-9.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -fembed-bitcode-marker -iquote /Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Pods-Gelato\ Today-DMMTodoTxt-generated-files.hmap -I/Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Pods-Gelato\ Today-DMMTodoTxt-own-target-headers.hmap -I/Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Pods-Gelato\ Today-DMMTodoTxt-all-target-headers.hmap -iquote /Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Pods-Gelato\ Today-DMMTodoTxt-project-headers.hmap -I/Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Products/Release-iphoneos/include -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Private -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Private/DMMTodoTxt -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/APAutocompleteTextField -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/Amplitude-iOS -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/Bugsnag -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/CGFloatType -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/DMMTodoTxt -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/Dropbox-iOS-SDK -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/FMDB -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/FXKeychain -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/KSCrash -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/Kiwi -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/PDGestureTableView -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/RJBlurAlertView -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/SpinKit -I/Users/delisa/Code/personal/Gelato/Pods/Headers/Public/UIImageEffects -I/Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/DerivedSources/arm64 -I/Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/DerivedSources -F/Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Products/Release-iphoneos -include /Users/delisa/Code/personal/Gelato/Pods/Target\ Support\ Files/Pods-Gelato\ Today-DMMTodoTxt/Pods-Gelato\ Today-DMMTodoTxt-prefix.pch -MMD -MT dependencies -MF /Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Objects-normal/arm64/DMMTodoTxtParser.d --serialize-diagnostics /Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Objects-normal/arm64/DMMTodoTxtParser.dia -c /Users/delisa/Code/personal/Gelato/Pods/DMMTodoTxt/Pod/Classes/DMMTodoTxtParser.m -o /Users/delisa/Library/Developer/Xcode/DerivedData/Gelato-cbyvaqwtjzrxxtfccjobyatrvvwh/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-Gelato\ Today-DMMTodoTxt.build/Objects-normal/arm64/DMMTodoTxtParser.o +) SAMPLE_SWIFT_COMPILE = %Q( CompileSwift normal arm64 /Users/paul/foo/bar/siesta/Source/Resource.swift cd /Users/paul/foo/bar/siesta From 456604313faf4a1de6a4e687c2412eaf6097c4b0 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Thu, 16 Aug 2018 09:32:21 -0700 Subject: [PATCH 61/61] Release v0.3.0 --- CHANGELOG.md | 14 ++++++++++++++ lib/xcpretty/version.rb | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 739b4bbb..c255ba76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.3.0 + +###### Enhancements + +* Add catch-all formatter to allow formatting unrecognized text + | [Chris Ballinger](https://github.com/chrisballinger) + | [#327](https://github.com/supermarin/xcpretty/pull/327) + +* Support `ccache-clang` (and other commands) in formatted output and JSON + compilation database reports + | [Delisa Mason](https://github.com/kattrali) + | [#332](https://github.com/supermarin/xcpretty/pull/332) + + ## 0.2.6 * Codesigning matchers improvements diff --git a/lib/xcpretty/version.rb b/lib/xcpretty/version.rb index 2f28e3d6..8842e6d0 100644 --- a/lib/xcpretty/version.rb +++ b/lib/xcpretty/version.rb @@ -1,4 +1,4 @@ module XCPretty - VERSION = "0.2.8" + VERSION = "0.3.0" end

<%= test[:name] %>

<% if test[:reason] %> @@ -158,6 +150,15 @@
<%= test[:snippet] %>
<%= test[:file] %>
<% end %> + <% if !test[:screenshots].empty? %> +
+ <% test[:screenshots].each_with_index do |screenshot, idx| %> + + + + <% end %> +
+ <% end %>