diff --git a/spec/slather/coverage_service/coveralls_spec.rb b/spec/slather/coverage_service/coveralls_spec.rb index a297f0ee..8625082d 100644 --- a/spec/slather/coverage_service/coveralls_spec.rb +++ b/spec/slather/coverage_service/coveralls_spec.rb @@ -158,6 +158,15 @@ before(:each) { fixtures_project.ci_service = :travis_ci project_root = Pathname("./").realpath + allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(%q( + { + "data":[ + { + "files":[] + } + ] + } + )) allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("#{project_root}/spec/fixtures/fixtures/fixtures.m: | 1|// | 2|// fixtures.m diff --git a/spec/slather/coverage_service/hardcover_spec.rb b/spec/slather/coverage_service/hardcover_spec.rb index 337d9fdb..ceed5cad 100644 --- a/spec/slather/coverage_service/hardcover_spec.rb +++ b/spec/slather/coverage_service/hardcover_spec.rb @@ -66,6 +66,15 @@ allow(Slather::Project).to receive(:yml).and_return(fixture_yaml) fixtures_project.ci_service = :jenkins_ci project_root = Pathname("./").realpath + allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(%q( + { + "data":[ + { + "files":[] + } + ] + } + )) allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("#{project_root}/spec/fixtures/fixtures/fixtures.m: | 1|// | 2|// fixtures.m @@ -104,7 +113,6 @@ it "should always remove the hardcover_json_file after it's done" do allow(fixtures_project).to receive(:`) - allow(fixtures_project).to receive(:jenkins_job_id).and_return("slather-master/9182") allow(fixtures_project).to receive(:coverage_service_url).and_return("http://api.hardcover.io") fixtures_project.post diff --git a/spec/slather/project_spec.rb b/spec/slather/project_spec.rb index 44683434..405e4749 100755 --- a/spec/slather/project_spec.rb +++ b/spec/slather/project_spec.rb @@ -72,6 +72,19 @@ class SpecXcode7CoverageFile < Slather::ProfdataCoverageFile allow(Dir).to receive(:[]).and_call_original allow(Dir).to receive(:[]).with("#{fixtures_project.build_directory}/**/Coverage.profdata").and_return(["/some/path/Coverage.profdata"]) allow(fixtures_project).to receive(:binary_file).and_return(["Fixtures"]) + allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(%q( + { + "data":[ + { + "files":[ + { + "filename":"spec/fixtures/fixtures/Fixtures.swift" + } + ] + } + ] + } + )) allow(fixtures_project).to receive(:profdata_llvm_cov_output).and_return("#{FIXTURES_SWIFT_FILE_PATH}: | 0| | 1|import UIKit @@ -111,6 +124,18 @@ class SpecXcode7CoverageFile < Slather::ProfdataCoverageFile allow(fixtures_project).to receive(:ignore_list).and_return([]) allow(Dir).to receive(:[]).with("#{fixtures_project.build_directory}/**/Coverage.profdata").and_return(["/some/path/Coverage.profdata"]) allow(fixtures_project).to receive(:binary_file).and_return(["Fixtures"]) + allow(fixtures_project).to receive(:unsafe_llvm_cov_export_output).and_return(" + { + \"data\":[ + { + \"files\":[ + { + \"filename\":\"sp\145c/fixtures/fixtures/fixtures.m\" + } + ] + } + ] + }") allow(fixtures_project).to receive(:unsafe_profdata_llvm_cov_output).and_return("#{FIXTURES_SWIFT_FILE_PATH}: 1| 8| func application(application: \255, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 1| 9| return true @@ -563,6 +588,22 @@ class SpecXcode7CoverageFile < Slather::ProfdataCoverageFile end it "should print out the coverage for each file, and then total coverage" do + allow(fixtures_project).to receive(:llvm_cov_export_output).and_return(%q( + { + "data":[ + { + "files":[ + { + "filename":"spec/fixtures/fixtures/fixtures.m" + }, + { + "filename":"spec/fixtures/fixturesTwo/fixturesTwo.m" + } + ] + } + ] + } + )) ["spec/fixtures/fixtures/fixtures.m: 3 of 6 lines (50.00%)", "spec/fixtures/fixturesTwo/fixturesTwo.m: 6 of 6 lines (100.00%)", "Tested 9/12 statements",