DashboardcliStricli run exit assertions

Stricli run exit assertions

Category: gotcha
Confidence: 1.00
ID: 01a088af-a0d1-71d1-86a6-af439057b87e
Project ID: c760f4f9-42b0-4ce0-b36d-6b8c38d770b2
Cross-project: No
Recalled in other projects: 0
Source session: 0iRbOD1VHj1PKYbvU
Created: 2026-09-10 00:20:06
Updated: 2026-09-10 00:20:06

Content

Trap: expecting run(app, argv, context) to reject looks correct because command bodies throw CliError, but Stricli catches command exceptions, formats them through customText, and records the mapped status on context.process.exitCode. Fix: await run() with a mock context, capture stdout/stderr, and assert mockContext.process.exitCode; reserve rejection assertions for errors deliberately rethrown to outer middleware.

Move to: