From cebde510abc8e46276e412943a08387d6732da53 Mon Sep 17 00:00:00 2001 From: Damon Aw Date: Fri, 10 Aug 2018 11:28:23 -0400 Subject: [PATCH 1/4] Explicitly print the exit status when SimpleCov fails the build --- features/minimum_coverage.feature | 2 ++ lib/simplecov.rb | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/features/minimum_coverage.feature b/features/minimum_coverage.feature index 1f8dd1c8..008325ed 100644 --- a/features/minimum_coverage.feature +++ b/features/minimum_coverage.feature @@ -17,6 +17,7 @@ Feature: When I run `bundle exec rake test` Then the exit status should not be 0 And the output should contain "Coverage (88.10%) is below the expected minimum coverage (90.00%)." + And the output should contain "SimpleCov failed build with exit 2" Scenario: Given SimpleCov for Test/Unit is configured with: @@ -31,6 +32,7 @@ Feature: When I run `bundle exec rake test` Then the exit status should not be 0 And the output should contain "Coverage (88.10%) is below the expected minimum coverage (88.11%)." + And the output should contain "SimpleCov failed build with exit 2" Scenario: Given SimpleCov for Test/Unit is configured with: diff --git a/lib/simplecov.rb b/lib/simplecov.rb index 11ab2db3..aae9fb6b 100644 --- a/lib/simplecov.rb +++ b/lib/simplecov.rb @@ -203,7 +203,10 @@ def run_exit_tasks! # Force exit with stored status (see github issue #5) # unless it's nil or 0 (see github issue #281) - Kernel.exit exit_status if exit_status && exit_status > 0 + if exit_status && exit_status > 0 + $stderr.printf("SimpleCov failed build with exit %d", exit_status) + Kernel.exit exit_status + end end # @api private From 914ae8474aa63310ec669e05fea96aa55b8575a1 Mon Sep 17 00:00:00 2001 From: Damon Aw Date: Fri, 10 Aug 2018 11:33:16 -0400 Subject: [PATCH 2/4] I want those bonus points --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44673f37..63d1cad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ + +=================== + +## Enhancements + +* Print the exit status explicitly when it's not a successful build so it's easier figure out SimpleCov failed the build in the output. + + 0.16.1 (2018-03-16) =================== From 3d2489578a52495e82f4b6350b9fa8426620a3c4 Mon Sep 17 00:00:00 2001 From: Damon Aw Date: Sat, 11 Aug 2018 23:22:18 -0400 Subject: [PATCH 3/4] It might not be a build, so simplify the wording --- lib/simplecov.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/simplecov.rb b/lib/simplecov.rb index aae9fb6b..e0223008 100644 --- a/lib/simplecov.rb +++ b/lib/simplecov.rb @@ -204,7 +204,7 @@ def run_exit_tasks! # Force exit with stored status (see github issue #5) # unless it's nil or 0 (see github issue #281) if exit_status && exit_status > 0 - $stderr.printf("SimpleCov failed build with exit %d", exit_status) + $stderr.printf("SimpleCov failed with exit %d", exit_status) Kernel.exit exit_status end end From a44de66ef071d31ad7eb2bc4dce52132c8e9be70 Mon Sep 17 00:00:00 2001 From: Damon Aw Date: Mon, 13 Aug 2018 09:47:36 -0400 Subject: [PATCH 4/4] Update specs too, I am an idiot :) --- features/minimum_coverage.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/minimum_coverage.feature b/features/minimum_coverage.feature index 008325ed..f51eccf7 100644 --- a/features/minimum_coverage.feature +++ b/features/minimum_coverage.feature @@ -17,7 +17,7 @@ Feature: When I run `bundle exec rake test` Then the exit status should not be 0 And the output should contain "Coverage (88.10%) is below the expected minimum coverage (90.00%)." - And the output should contain "SimpleCov failed build with exit 2" + And the output should contain "SimpleCov failed with exit 2" Scenario: Given SimpleCov for Test/Unit is configured with: @@ -32,7 +32,7 @@ Feature: When I run `bundle exec rake test` Then the exit status should not be 0 And the output should contain "Coverage (88.10%) is below the expected minimum coverage (88.11%)." - And the output should contain "SimpleCov failed build with exit 2" + And the output should contain "SimpleCov failed with exit 2" Scenario: Given SimpleCov for Test/Unit is configured with: