Skip to content

Commit 5d3ade7

Browse files
committed
test
1 parent 924b90e commit 5d3ade7

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

buildspec/linuxE2ETests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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}"

buildspec/linuxIntegrationTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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}"

buildspec/linuxTests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

scripts/mergeReports.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff 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

6871
mergeReports()

0 commit comments

Comments
 (0)