-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
karma run
overwrites client.args state
#1746
karma run
overwrites client.args state
#1746
Comments
Workaround for karma-runner#1746
Workaround for karma-runner#1746
Workaround for karma-runner#1746
Some introspection into whether or not the objects share properties would be really great. I'm experiencing a pretty crummy situation right now with
//...
browserStack: {
'startTunnel': true,
'project': 'some_project_name',
'build': 'some_build_name',
'rateLimitTimeout': 5000
},
//... This command, run by Jenkins or some other CI system that wants to pass username/access tokens would look like: karma start --browserstack.username=my_username --browserstack.accessKey=some_key Executing this will essentially throw away any configuration that would have been made in The workaround in my situation is to have the CI pass all of the arguments. And then I lose all of the flexibility of having the keys in a configuration file for developers to share. I'm not sure whether your situation, @danielcompton, is unique to |
This sounds like a similar problem of handling input from the command line, although the exact mechanics to fix it will be different. |
Thanks @danielcompton for the detailed write up. From looking at this I feel the most sensible option would be to merge the two together (with the options provided from |
Yep, I think you're right, that was the conclusion I came to. It could also be good to make the Karma config created at |
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
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
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
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
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
Summary
karma run
calls this line lib/middleware/runner.js#L50 which overwrites the state ofconfig.client.args
with an empty array. This means that plugins that rely onconfig.client.args
will run when callingkarma start
, but fail after callingkarma run
once (even when they are subsequently autorun from thekarma start
process).Details
I'm using karma-cljs-test to run my ClojureScript tests. It needs a main function to be provided in
config.client.args
. I was able to run my tests successfully through the auto runner inkarma start
but when I calledkarma run
, my tests would fail to run asconfig.client.args
had been overwritten with an empty array. Becauseconfig
is a mutable object, once I had calledkarma run
once, my tests would fail when being rerun by thekarma start
autorunner.Commenting out
let my tests pass, but this is clearly not a viable solution. One option would be to only set
config.client.args
ifdata.args
is not an empty array.This also raises the wider question of why a
karma run
is setting global mutable state. That behaviour was surprising to me, and I don't think it is intentional.This behaviour seems to have been introduced in ca4c4d8, and relates to 27b8d67, #283, karma-runner/grunt-karma#79, karma-runner/grunt-karma#79, karma-runner/grunt-karma@b658ec9 and karma-runner/grunt-karma@168f7b7.
The text was updated successfully, but these errors were encountered: