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

fix(runner): Merge config.client.args with client.args provided by run #1934

Merged
merged 1 commit into from
Jun 23, 2016

Conversation

danielcompton
Copy link
Contributor

Before this change, calling karma run would overwrite any value in config.client.args with the value provided in the karma run request, even if that value was an empty array. This commit does a _.merge to merge the two values together.

Fixes #1746

@@ -166,6 +166,28 @@ describe('middleware.runner', () => {
request.emit('end')
})

it('calling run with no client args should not overwrite existing client.args', (done) => {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a test for the actual merge with different values please?

@danielcompton
Copy link
Contributor Author

I've added tests for the following cases:

  • existing config client.args, empty array run client.args
  • existing config client.args, nothing passed for run client.args
  • existing config client.args, value passed for run client.args
  • no config client.args, value passed for run client.args
  • empty map client.args, value passed for run client.args

The only wrinkle here, and I'm not sure what can be done about it, is if the user passes [] as client.args, and a map as run client.args. _.merge doesn't convert the [] into a map, and discards the run args.

@budde377
Copy link
Member

@danielcompton, How about checking the type of the client-args and take appropriate measures?
E.g. using the helpers in https://github.com/karma-runner/karma/blob/master/lib/helper.js#L20 .

@danielcompton
Copy link
Contributor Author

What is the expected behaviour for merging an array and a map, and for merging a map and an array?

@budde377
Copy link
Member

God question, maybe just let the run args override the existing?

On Mon, Feb 29, 2016, 09:17 Daniel Compton notifications@github.com wrote:

What is this the expected behaviour for merging an array and a map, and
for merging a map and an array?


Reply to this email directly or view it on GitHub
#1934 (comment).

@dignifiedquire
Copy link
Member

Yes I think in the case that the the types are not mergeable, i.e. array < object or object < array, we should override and print a warning.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

Before this change, calling `karma run` would overwrite any value in
config.client.args with the value provided in the `karma run` request,
even if that value was an empty array. This commit does a _.merge to
merge the two values together.

Fixes karma-runner#1746
@googlebot
Copy link

CLAs look good, thanks!

@danielcompton
Copy link
Contributor Author

This is ready for review now.

@dignifiedquire
Copy link
Member

Thanks :octocat:

@dignifiedquire dignifiedquire merged commit ddba770 into karma-runner:master Jun 23, 2016
@danielcompton
Copy link
Contributor Author

Thank you!

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.

None yet

4 participants