diff --git a/dist/index.js b/dist/index.js index ccd64cae..355c1499 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11337,7 +11337,6 @@ function runTests(colconCommandPrefix, options, testPackageSelection, colconExtr `colcon`, `test`, `--event-handlers=console_cohesion+`, - `--return-code-on-test-failure`, ...testPackageSelection, ...colconExtraArgs, ]; @@ -11346,6 +11345,15 @@ function runTests(colconCommandPrefix, options, testPackageSelection, colconExtr } if (doTests) { yield execShellCommand([...colconCommandPrefix, ...colconTestCmd], options, false); + /** + * Display all test results first and ignore the return code. Then, display only failing + * tests with their output and let non-zero return code fail the job. + */ + const colconTestResultCmd = ["colcon", "test-result"]; + const colconTestResultAllCmd = [...colconTestResultCmd, "--all"]; + const colconTestResultVerboseCmd = [...colconTestResultCmd, "--verbose"]; + yield execShellCommand([...colconCommandPrefix, ...colconTestResultAllCmd], Object.assign(Object.assign({}, options), { ignoreReturnCode: true }), false); + yield execShellCommand([...colconCommandPrefix, ...colconTestResultVerboseCmd], options, false); } if (doLcovResult) { // ignoreReturnCode, check comment above in --initial diff --git a/src/action-ros-ci.ts b/src/action-ros-ci.ts index c1ae6d30..f432e59d 100644 --- a/src/action-ros-ci.ts +++ b/src/action-ros-ci.ts @@ -239,7 +239,6 @@ async function runTests( `colcon`, `test`, `--event-handlers=console_cohesion+`, - `--return-code-on-test-failure`, ...testPackageSelection, ...colconExtraArgs, ]; @@ -253,6 +252,27 @@ async function runTests( options, false ); + + /** + * Display all test results first and ignore the return code. Then, display only failing + * tests with their output and let non-zero return code fail the job. + */ + const colconTestResultCmd = ["colcon", "test-result"]; + const colconTestResultAllCmd = [...colconTestResultCmd, "--all"]; + const colconTestResultVerboseCmd = [...colconTestResultCmd, "--verbose"]; + await execShellCommand( + [...colconCommandPrefix, ...colconTestResultAllCmd], + { + ...options, + ignoreReturnCode: true, + }, + false + ); + await execShellCommand( + [...colconCommandPrefix, ...colconTestResultVerboseCmd], + options, + false + ); } if (doLcovResult) {