`ng test` should accept argument for karma configuration file
As discussed with @hansl, currently there is no way to specify the location of karma.conf.js when running ng test. We should allow this to be specified so that angular-cli can be used with projects that do not place config files in their default locations.
Actually the solution would not be argument but a metadata with sensible default. I'll work on this.
Does this make a lot of sense given that the file is generated by the CLI and will therefore be in a consistent location?
Projects might want to move it (e.g. Material2 has it in test/). There should be a way to set its location in the package.json.
Point taken.
Then I agree we should store the location within package.json
Is there a scenario where we would need to support multiple configuration files? I'd prefer to cover all those scenarios up front rather than have multiple ways to store the config info.
Yeah I'm not 100% sure about multiple test files, but we can revisit.
The option --config-file seems to already be there?
--config-file (String) aliases: -c <value>, -cf <value>
Although, riscie, those aliases/options do not appear to work.
An example scenario for multiple test configs:
- karma.conf.js - Regular unit tests, run in Phantom or whatever browsers are passed in.
- karma.browserstack.conf.js - CI-run automated tests against all browsers in our preflight and postflight jobs.
This is something I can take a look at over the next few days.
Any update?
@hansl @Brocco I'm also all for possible multiple config files. I know, I'm always coming up with very specific use cases, but that's all I have :D
As we're using angular-cli in our trainings, we want to be able to run tests normally using
$ ng test
But then there's another testsuite for us training that we want to run to verify our labs are working. So then something like
$ ng test --config-file=foo.config.ts
Would be really need.
@krotscheck 's scenario also seems very valid to me.
An example scenario for multiple test configs:
karma.conf.js - Regular unit tests, run in Phantom or whatever browsers are passed in. karma.browserstack.conf.js - CI-run automated tests against all browsers in our preflight and postflight jobs.
Is this possible still?
@lohiarahul ng t --config configname.js
@lohiarahul ng t --config configname.js
the build doesn't bundle up the "Alternative Config File" and the CI process fails. Any way to include the other file in the bundle?
@lohiarahul why want to bundle karma config ?
i have 2 featured modules, which I would like to unit test seperately .
I am using angular-cli , angular 5.
The build will be one , where 2 applications will be shown via the lazy loading .
I want to have seperate testing for these modules. Can some one guide me how to do it ?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.