Initial Workflow
Our current Unit Testing job runs on Node.js v18 and v20 across Ubuntu and macOS. If any step fails, subsequent steps (like archiving test results) are skipped:Simulating a Failing Test
Modifyapp-test.js to introduce an assertion error and force a failure:

Understanding Step Contexts
GitHub Actions exposes asteps context to examine the outcome of previous steps. Each step can have properties like outcome, conclusion, and custom outputs accessible by its id.
You can learn more about contexts in the official docs:
Contexts documentation
Contexts documentation


Assigning an ID to the Testing Step
Give your test step anid so other steps can refer to it:
Status Check Functions
Use built-in functions to control when steps run:| Function | Description |
|---|---|
success() | Only if all previous steps and jobs succeeded (default) |
failure() | Only if a previous step or job failed |
always() | Run regardless of the outcome of previous steps or jobs |

Conditional Archive Step
1. Archive Only on Failure
To upload artifacts only when tests fail:

2. Archive on Every Run
If you want the test results available on both success and failure, usealways():
