Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the option to choose which branch to test #151

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

bjohansebas
Copy link
Contributor

The option to choose which branch to use as a reference for testing is added, as the main branch will not always be the one selected.

@bjohansebas bjohansebas changed the title Add the option to choose which branch to test [WIP]: Add the option to choose which branch to test Feb 17, 2025
@bjohansebas bjohansebas marked this pull request as ready for review February 17, 2025 03:03
.option('branch', {
desc: 'Branch that was chosen for testing',
type: 'string',
conflicts: 'config'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would this conflict with config? Id expect the config to be overridden by command line flags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just following how the other options were programmed, although what you're saying makes sense.

@bjohansebas bjohansebas changed the title [WIP]: Add the option to choose which branch to test add the option to choose which branch to test Feb 18, 2025
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good overall

bin/commands/test.js Outdated Show resolved Hide resolved
bin/commands/result.js Outdated Show resolved Hide resolved
@@ -18,7 +22,7 @@ exports.builder = (yargs) => yargs
exports.handler = async (params) => {
const config = params.dependent
? {
dependents: [{ repository: params.dependent }]
dependents: [{ repository: params.dependent, branch: params?.branch || 'HEAD' }]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either params.dependent needs optional chaining, or params.branch doesn't

@@ -24,7 +28,7 @@ exports.builder = (yargs) => yargs
exports.handler = (params) => {
const config = params.dependent
? {
dependents: [{ repository: params.dependent, pullRequest: !!params['pull-request'] }]
dependents: [{ repository: params.dependent, pullRequest: !!params['pull-request'], branch: params?.branch || "HEAD" }]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either params.dependent and params['pull-request'] both need optional chaining, or params.branch doesn't

@bjohansebas
Copy link
Contributor Author

Optional chaining is not available for Node 12 :(

@ljharb
Copy link
Member

ljharb commented Feb 20, 2025

but the pre-existing code also suggests it's not needed. maybe it's just IDE types that are wrong?

@bjohansebas
Copy link
Contributor Author

Probably

@bjohansebas
Copy link
Contributor Author

I don't understand why it doesn't work for Node 12 now, there hasn't been any change that should break compatibility.

@ljharb
Copy link
Member

ljharb commented Feb 20, 2025

try rebasing instead of merging and force push?

@bjohansebas
Copy link
Contributor Author

I've found the error :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants