From 1ae42a5c134acdcf8c99d07d1cce90bc55adb64a Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 10 May 2024 16:40:18 -0400 Subject: [PATCH] chore(ci): exit with correct exit code (#29425) The docker script does not exit with the correct exit code when invoking commends in `execa`. You can verify this by changing `npm run test.e2e` in the script to `npm run foo` (a non-existent script). The underlying command will fail, but the parent script will still exit with exit code 0. Important: The tests themselves have always errored correctly, so this does not impact test execution. Only the invocation of the test command is impacted. This PR ensures that invoking the wrong command causes the parent script to exit with the correct code. Co-authored-by: Brandy Carney --- core/scripts/docker.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/scripts/docker.mjs b/core/scripts/docker.mjs index f723305459..5c23812d2e 100644 --- a/core/scripts/docker.mjs +++ b/core/scripts/docker.mjs @@ -53,4 +53,7 @@ if (requestHeaded && !hasHeadedConfigFiles) { console.warn(chalk.yellow.bold('\n⚠️ You are running tests in headed mode, but one or more of your headed config files was not found.\nPlease ensure that both docker-display.txt and docker-display-volume.txt have been created in the correct location.\n')); } -execa('docker', args, { shell: true, stdio: 'inherit' }); +const res = await execa('docker', args, { shell: true, stdio: 'inherit' }); + +// If underlying scripts failed this whole process should fail too +process.exit(res.exitCode);