File tree Expand file tree Collapse file tree 4 files changed +16
-13
lines changed
Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ phases:
3737 commands :
3838 - export HOME=/home/codebuild-user
3939 # Ignore failure until throttling issues are fixed.
40- - xvfb-run npm run testE2E; PREVIOUS_TEST_EXIT_CODE=$? npm run mergeReports
40+ - xvfb-run npm run testE2E; npm run mergeReports -- "$?"
4141 - VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
4242 - CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
4343 - CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ phases:
9292 build :
9393 commands :
9494 - export HOME=/home/codebuild-user
95- - xvfb-run npm run testInteg; PREVIOUS_TEST_EXIT_CODE=$? npm run mergeReports
95+ - xvfb-run npm run testInteg; npm run mergeReports -- "$?"
9696 - VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
9797 - CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
9898 - CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ phases:
4141 # Ensure that "foo | run_and_report" fails correctly.
4242 set -o pipefail
4343 . buildspec/shared/common.sh
44- 2>&1 xvfb-run npm test --silent; PREVIOUS_TEST_EXIT_CODE=$? npm run mergeReports | run_and_report 2 \
44+ 2>&1 xvfb-run npm test --silent; npm run mergeReports -- "$?" | run_and_report 2 \
4545 'rejected promise not handled' \
4646 'This typically indicates a bug. Read https://developer.mozilla.org/docs/Web/JavaScript/Guide/Using_promises#error_handling'
4747 }
Original file line number Diff line number Diff line change @@ -53,16 +53,19 @@ async function mergeReports() {
5353
5454 fs . writeFileSync ( path . join ( reportsDir , 'report.xml' ) , xml )
5555
56- /**
57- * Retrieves the exit code from the previous test run execution.
58- *
59- * This allows us to:
60- * 1. Merge and upload test reports regardless of the test execution status
61- * 2. Preserve the original test run exit code
62- * 3. Report the test status back to CI
63- */
64- const exitCode = parseInt ( process . env . PREVIOUS_TEST_EXIT_CODE || '0' , 10 )
65- process . exit ( exitCode )
56+ const exitCodeArg = process . argv [ 2 ]
57+ if ( exitCodeArg ) {
58+ /**
59+ * Retrieves the exit code from the previous test run execution.
60+ *
61+ * This allows us to:
62+ * 1. Merge and upload test reports regardless of the test execution status
63+ * 2. Preserve the original test run exit code
64+ * 3. Report the test status back to CI
65+ */
66+ const exitCode = parseInt ( exitCodeArg || '0' , 10 )
67+ process . exit ( exitCode )
68+ }
6669}
6770
6871mergeReports ( )
You can’t perform that action at this time.
0 commit comments