-
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
Feature extend config syntax Issue #278 #317
Conversation
Sorry, I fail at github. I was trying to add this as a pull request under issue #278. Not sure how it ended up as a separate thing. |
I'll jump in here. Please read the Contributing.md - Initial setup instructions. They include details about commit message formatting (and how to automatically enforce it). You're going to need to redo these commits to match. I also added some inline code review comments. I'm not the project owner take my feedback with a grain of salt. Re github: It's cool. We're all beginners at some point. Thanks for contributing! |
Weird. Before committing I ran |
re init-dev-env: ... oh great. It works for me from the command line, but if I use "git gui" it doesn't. :( Filed #319. |
I added the normalization @bitwiseman talks about to maintain backwards compatibility, and I've reverted most of the changes to the tests. It also handles adding args, rather than replacing. I think that answers most of the design concerns @bitwiseman mentions. |
FWIW, I originally went for replacing the default options, rather than appending, because the Opera.js launcher looked like it might need all of the options to precede the URL. I didn't know enough about the various browsers to be sure that none of them would need the flexibility of more complete control over the args, but if the order of the arguments isn't important and if folks never need to remove any of the default args, then it's more convenient and probably hits most use cases if we simply append. What's the next step? @DavidSouther sent a pull request that seems to address many of @bitwiseman's concerns (thanks!), but it looks like we both probably need to fix our commit log messages, perhaps scrap the variable substitution stuff, and add some more tests. Do we keep plowing ahead on this branch? Should we try to rebase this into a cleaner set of patches (e.g., eliminating changes in the tests that I shouldn't have changed) or is it better to close this and cherry pick changes onto a new branch? Or maybe wait for direction from maintainers? :) |
Arg ordering: you may be right about Opera ordering - it can still be additive, but the launcher can put config args before the url. The replace scenario is also worth doing, I just want to iterate to it. I can help with the commit messages. You can wait to see if maintainers have an opinion, but if you're amenable, we're making prgress, I'd say "be bold" - branch off your changes for safekeeping, then let's roll forward. |
@@ -40,7 +40,7 @@ var processArgs = function(argv, options) { | |||
} | |||
|
|||
if (helper.isString(options.browsers)) { | |||
options.browsers = options.browsers.split(','); | |||
options.browsers = options.browsers.split(',').map(function(browser) { return { name: browser }; }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no one liners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer to see
options.browsers = options.browsers.split(',')
.map(function(browser) { return { name: browser }; });
or
options.browsers = options.browsers.split(',')
.map(function(browser) {
return { name: browser };
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of them ;) I think
options.browsers = options.browsers.split(',').map(function(browser) {
return { name: browser };
});
is the way to go. But at this point I want your version anyhow with the normalization so I think we can actually remove this and leave cli.js untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I think I like that better as well.
Wow. First of all thanks to all who contributed to the PR and the discussion. I've added some comments inline for basic stuff. To answer and clarify some of the rest
|
@dignifiedquire thanks for the commentary, I've addressed them in my branch. Would it make most sense for @animous to rebase and squash all these commits? |
@DavidSouther Thanks. Yes squashing is the way to go. |
I tried to address the comments above by rebasing and squashing. It sounded like maybe I'm supposed to Update: @bitwiseman says |
Any updates on this? Has the code been merged/will it be merged/if so, when? |
@@ -13,7 +13,7 @@ exclude = [ | |||
]; | |||
|
|||
autoWatch = true; | |||
browsers = ['Chrome']; | |||
browsers = [{ name: 'Chrome' }]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert this back to ['Chrome']
?
@animous I've added some small comments inline. One thing could you add a test for the config if it correctly normalizes the browsers? Otherwise I'd say it looks good to merge. What do you think @vojtajina? @DavidSouther Sorry for the delay, still working on those docs.. |
Support optional `cmd` and `args` parameters in the `browsers` configuration. The `args` are appended to the default command-line options for the browser. If `overrideArgs` is true, then the `args` replace the default command-line options for the browser. Occurrences of `$TEMPDIR` or `$URL` within the `args` are replaced by the temp directory and URL. Use case is to pass special options, e.g., to load browser extensions. Closes karma-runner#278
@dignifiedquire I reverted the changes to For the other comments on test/unit/config.spec.coffee, I copied @DavidSouther's config7.js test to config8.js and reverted the change to config7.js in hopes that it will be clearer that we're covering the "normalize strings" case as well as the "normalize string and object" case. (I probably could have replied inline above, but wasn't sure what would happen to those inline comments when I brazenly I squashed the reverts and edits into the original commit, rebased onto the latest master, and did a |
@animous Thanks for all the good work. From my side it looks good. Will need to wait for @vojtajina to give its 👍 |
A couple little nitpicks that got lost in the shuffle. Other than that, LGTM. |
Guys, thanks everyone! This is really great, people even reviewing pull requests. After a quick look, it looks good to me. I'm gonna merge it after the refactoring branch, because I already separated all the launchers into separate npm modules (plugins): https://github.com/vojtajina/testacular/tree/using-di I will take care of merging this PR with the branch mentioned. |
Has this been merged in? |
I'm new to Karma, but I'm exceptionally excited about this change! |
Really looking forward to this blocker biting the dust as well! |
I'm waiting for this to be merged any day now. |
karma.defineLauncher('my_chrome', 'Chrome', { flags: ['--start-maximized'] }); karma.definePreprocessor('coffee_bare', 'coffee', { options: { bare: true } }); karma.defineReporter('html_coverage', 'coverage', { ... }); The reason, why I decided for this solution, rather than inlining like this: browsers = [{ type: 'Chrome', flags: ['--start-maximized'] }]; Is that the solution above allows using these custom launchers from CLI. It also makes it easier to create only a single instance of a preprocessor (if the configuration is the same). Closes karma-runner#317
Guys, please check out the PR #533 |
Changed
browsers
configuration syntax as suggested in https://github.com/testacular/testacular/issues/278#issuecomment-11986383 except that I didn't know what to do with theheadless:
key proposed there. The list of args, if provided, completely replaces the default args normally used by that launcher. Within the arg list, occurrences of$TEMPDIR
and$URL
are replaced by the temporary dir and the URL passed in to browser.start, respectively. There is also acmd:
for specifying the path to the executable.So
browsers
can now be: