SP-1089: Command integration tests#374
Merged
Merged
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>
Jing Sun (kuvia)
previously approved these changes
Jun 11, 2026
Eszter Galicz (celeszter)
previously approved these changes
Jun 15, 2026
adedaf0
|
Kastriot Salihu (ksalihu)
approved these changes
Jun 17, 2026
Zgjim Haziri (ZgjimHaziri)
added a commit
that referenced
this pull request
Jun 17, 2026
Resolve modify/delete conflict in the configuration-management tests. SP-1089 (#374) deleted the per-module unit spec (tests/commands/configuration-management/module.spec.ts) in favor of an integration spec. Port the `config package export` handler tests into tests/integration/commands/configuration-management.spec.ts (driven via the CLI parser, so the unzipped default asserts zip=false) and accept the deletion of the old unit spec. 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:run()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.parseAsyncparse(nowparseAsync)Relevant links
Checklist