SP-1090: Assert on real process output and exit codes in integration tests#375
Conversation
85c04e4 to
f5eb0b2
Compare
f5eb0b2 to
e82e2a3
Compare
| }); | ||
|
|
||
| describe("config export", () => { | ||
| it("downloads zip and exits 0", async () => { |
There was a problem hiding this comment.
I'm confused, you added new tests but I understood that the existing integration tests in integration/commands/asset-registry.spec.ts and integration/commands/configuration-management.spec.ts should be enhanced by asserting on stdout. They also cover a lot more cases than those three here.
…-registry and config commands
There was a problem hiding this comment.
I think instead of adding new tests the existing tests should use your runCliProcess. You probably don't need to assert on the exit code in every test but the output is different for every command probably.
|
|
||
| const GRACEFUL_MESSAGE = "graceful failure - should not fail the process"; | ||
|
|
||
| class DiagnosticsModule extends IModule { |
There was a problem hiding this comment.
This class isn't needed as it's just example tests once you've updated the other ones we are covering most of the agentic commands.
…-1090-content-cli-assert-on-real-process-output-and-exit-codes-in-integration-tests
|



Description
Changes
module-handler.ts: the shared command action wrapper now setsprocess.exitCode = 1when a command throws, so errors surface as a non-zero exit code (previously thrown errors were only logged and the process still exited0).GracefulErroris preserved as exit0.package.manager.ts: fixed a bareprocess.exit()(exited0) on an error branch →process.exit(1).Tests Added
tests/utls/cli-runner.ts(runCli), which drives a command through the real Commander wiring and captures the actualstdout,stderr, and exit code.tests/integration/cli-process-output.spec.tsasserting real output + exit codes for success and failure cases (asset-registry as the agentic-dev surface, plus version/unknown-command/required-option, and the GracefulError vs. regular-error exit-code contract).Relevant links
Checklist