SP-1089: Command integration tests#374
Draft
Thomas Neumüller (tneum-celonis) wants to merge 2 commits into
Draft
SP-1089: Command integration tests#374Thomas Neumüller (tneum-celonis) wants to merge 2 commits into
Thomas Neumüller (tneum-celonis) wants to merge 2 commits into
Conversation
Captures the implementation plan to drive Content CLI command tests through the real Commander parser via parseAsync, including refactoring src/content-cli.ts to expose a createProgram factory and relocating the two existing module specs under tests/integration/commands. Includes-AI-Code: true Co-authored-by: Cursor <cursoragent@cursor.com>
Refactor the CLI bootstrap to expose a `createProgram(context, opts)`
factory and gate the runtime entry behind `if (require.main === module)`,
so tests can build isolated Commander programs and invoke commands via
`parseAsync` instead of poking private action methods. The bin entry
keeps the existing banner/debug behaviour by parsing global options
through a small bootstrap `Command` before context init.
Replace the two module-level specs with integration tests under
`tests/integration/commands/` that drive each command through real
Commander parsing, exercising option defaults/coercion. Action-body
validation errors are caught by `Configurator.action`, so tests now
assert on the in-memory winston transport rather than promise rejection.
A new `tests/utls/cli-program.ts` helper wires `testContext` into the
factory while skipping filesystem-based module discovery (incompatible
with the `jest.mock("fs")` setup).
Includes-AI-Code: true
Co-authored-by: Cursor <cursoragent@cursor.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Based on the plan in #373.
Drives Content CLI command tests through the real Commander parser instead of poking private action methods. The two existing "module" specs bypassed Commander's command registration, option parsing, defaults, type coercion, and validation. After this change, tests mirror what an end user types and run through the same parse path the
content-clibinary uses.src/content-cli.ts: exposes a command factory and hidesrun()behind a module check to prevent running in test modetests/utls/cli-program.ts: WirestestContextintocreateProgramand skips filesystem-based module discovery (which would conflict with fs mocks)program.parseAsync. Service mocks and call-arg assertions are preserved (with values updated to reflect Commander's actual parsing — e.g. flags with an empty-string default stay""when omitted).parse(nowparseAsync)Relevant links
Checklist