Commit a1962bf
fix: correct JSON field names in list-commands tests and remove process.exit mock-with-throw pattern
Root cause of 26 CI failures:
- logger.table() in JSON mode serializes display column names as keys
(Key, 'Process ID', 'Process Instance', State, Type, etc.) not the raw
API field names (processDefinitionKey, processInstanceKey, state, type)
- before() was extracting items[0].processDefinitionKey etc. → all undefined
- search CLI assertions used it.state, it.type, it.processDefinitionId etc.
→ all undefined, causing assertion failures
Fixes in tests/integration/list-commands.test.ts:
- before(): use items[0].Key for all key extraction
- before(): use items[0]['Process Instance'] for processInstanceKey in incidents
- before(): use jobs[0].State (not j.state) for job state check
- before(): add assert.ok guards so setup failures are immediately visible
- search CLI tests: fix all field names to match table column names
- remove function-level test section (violates project guideline to only
use CLI commands in integration tests; also fragile due to global
logger mode state)
process.exit mock-with-throw pattern removed:
- tests/unit/completion.test.ts: replaced process.exit stub with spawnSync
(runs CLI as real subprocess, asserts on status/stderr/stdout)
- tests/integration/profile-switching.test.ts: replaced process.exit mock
with spawnSync-based test that asserts list pi exits with code 1
Co-authored-by: vobu <6573426+vobu@users.noreply.github.com>1 parent 8afec43 commit a1962bf
File tree
3 files changed
+125
-297
lines changed- tests
- integration
- unit
3 files changed
+125
-297
lines changed
0 commit comments