-
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
Give karma.config.js access to command line arguments #1561
Give karma.config.js access to command line arguments #1561
Comments
This would definitely be useful, such as for turning on/off coverage instrumentation via commandline when using non-standard processors like webpack. |
I agree, and can see how this could be useful. If someone wants to work on this I'd be happy to accept a PR |
Cool. I'll submit a PR for this. Thanks! |
A workaround that currently exists would is #61 (comment). I'm planning on using the suggestion in order to toggle coverage as @dtabuenc mentioned. |
PR submitted |
…config feat(scope): Pass CLI arguments to karma.config.js. Closes #1561
@danielsiwiec could you make a PR with some docs about this please? Thanks |
Good idea. Will do shortly |
Thanks @dignifiedquire @danielcompton. I figured out after posting that it's mentioned in the OP (resolved config is under |
CLI args are passed to karma on the config object See: karma-runner/karma#1561
CLI args are passed to karma on the config object See: karma-runner/karma#1561
Currently, the
config
argument passed into karma.config.js is an empty object, that gets filled out. It would be beneficial, to have access to command line arguments from within the configuration, through the passedconfig
object, as this would allow custom logic, based on those arguments to be applied.Example scenario: There are two test suites (eg. unit and component) in two different folders. It's desired to run only the selected test suite. This could easily be achieved by passing an argument on the command line (like
suite=unit
), that karma.config.js would have access to and would set the proper value on theconfig.files
property.What do people think about it? The implementation of this would be very straightforward (basically a one-liner).
The text was updated successfully, but these errors were encountered: