test: add cherry-pick unit tests for pure helpers#848
Merged
Conversation
Member
|
@codebytere, looks like CI is unhappy here. |
ckerr
reviewed
Apr 26, 2026
Member
ckerr
left a comment
There was a problem hiding this comment.
the refactor sounds like a good idea, needs another update to get the tests passing
Extract splitPositionalArgs, computeBatchId, and formatPRTitleAndBody from the cherry-pick action handler, export the existing isUrl and commitSubject helpers, and gate program.parse() behind import.meta.main so the module is importable from tests. Add tests/e-cherry-pick.spec.mjs covering all five exports.
Several src/e-*.ts modules share commander's default `program` singleton.
When tests import more than one of these modules (e.g. parsers.spec.mjs
imports both e-open and e-pr), each module's CLI definitions are
appended to the same shared program. Adding a non-variadic positional
after another module's variadic positional throws ("only the last
argument can be variadic"), and required-argument errors call
process.exit at import time.
Switch e-cherry-pick, e-open, e-pr, and e-rcv to use their own
`new Command()` instance so each module owns its CLI surface and can be
imported safely from the vitest suites.
a301e4b to
5e0b550
Compare
dsanders11
approved these changes
Apr 27, 2026
jkleinsc
approved these changes
Apr 27, 2026
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.
Extract splitPositionalArgs, computeBatchId, and formatPRTitleAndBody from the cherry-pick action handler, export the existing isUrl and commitSubject helpers, and gate program.parse() behind import.meta.main so the module is importable from tests. Add tests/e-cherry-pick.spec.mjs covering all five exports.