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

ng test should accept argument for karma configuration file #183

Closed
traviskaufman opened this issue Feb 10, 2016 · 17 comments
Closed

ng test should accept argument for karma configuration file #183

traviskaufman opened this issue Feb 10, 2016 · 17 comments
Assignees
Labels
effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@traviskaufman
Copy link

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.

@hansl
Copy link
Contributor

hansl commented Feb 10, 2016

Actually the solution would not be argument but a metadata with sensible default. I'll work on this.

@Brocco
Copy link
Contributor

Brocco commented Feb 10, 2016

Does this make a lot of sense given that the file is generated by the CLI and will therefore be in a consistent location?

@hansl
Copy link
Contributor

hansl commented Feb 10, 2016

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.

@Brocco
Copy link
Contributor

Brocco commented Feb 10, 2016

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.

@hansl hansl self-assigned this Feb 10, 2016
@hansl
Copy link
Contributor

hansl commented Feb 10, 2016

Yeah I'm not 100% sure about multiple test files, but we can revisit.

@filipesilva filipesilva added command: test effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Jun 4, 2016
@riscie
Copy link

riscie commented Jun 6, 2016

The option --config-file seems to already be there?

--config-file (String) aliases: -c <value>, -cf <value>

@hansl hansl modified the milestone: RC1 Nov 11, 2016
@ghost
Copy link

ghost commented Dec 8, 2016

Although, riscie, those aliases/options do not appear to work.

@krotscheck
Copy link

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.

@Brocco
Copy link
Contributor

Brocco commented Jan 8, 2017

This is something I can take a look at over the next few days.

@Brocco Brocco assigned Brocco and unassigned hansl Jan 8, 2017
@FJLopezGarcia
Copy link

Any update?

@0x-r4bbit
Copy link

@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.

@codermannn
Copy link

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?

@kuncevic
Copy link

@lohiarahul ng t --config configname.js

@codermannn
Copy link

@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?

@kuncevic
Copy link

@lohiarahul why want to bundle karma config ?

@AngularTx
Copy link

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 ?

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests