From 3d0d1f7421c41b86c93da7c445eff1ffb232a613 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Tue, 8 Sep 2020 17:36:03 -0700 Subject: [PATCH] fix(builtin): fix bazel coverage masking test failures --- internal/node/launcher.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/node/launcher.sh b/internal/node/launcher.sh index 658ed93077..e685da732e 100644 --- a/internal/node/launcher.sh +++ b/internal/node/launcher.sh @@ -352,6 +352,15 @@ if [ "${EXPECTED_EXIT_CODE}" != "0" ]; then fi fi +# Do not collect coverage for failed tests +if [ ${RESULT} -ne 0 ]; then + if [[ -n "${EXIT_CODE_CAPTURE}" ]]; then + exit 0 + else + exit ${RESULT} + fi +fi + # Post process the coverage information after the process has exited if [[ -n "${COVERAGE_DIR:-}" ]]; then if [[ -n "${VERBOSE_LOGS:-}" ]]; then @@ -366,8 +375,8 @@ if [[ -n "${COVERAGE_DIR:-}" ]]; then RESULT="$?" set -e - if [ ${RESULT} -ne 0 ]; then - exit ${RESULT} + if [[ -n "${EXIT_CODE_CAPTURE}" ]]; then + echo "${RESULT}" > "${EXIT_CODE_CAPTURE}" fi fi