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
Documentation should be explicit on what to use instead of ng test --reporters #10852
Comments
It is not necessary use --reporters. Only with Karma.conf Example file Karma.conf:
|
Well, it's bad news that we can't use a specific reporter via command line.
In my use case, we use teamcity-reporter only on the CI server. Now, do we
have to create an additional karma config file for our CI server?
|
You should edit karma.conf, add dependency in plugins and add to reporters new type. For example:
|
Yes, thank you, I got that. But is it possible to use different reporters based on a command-line arg? |
If we can't have specific arguments such as reporters, could a cli arg be exposed to tell which karma configuration file to use? |
Yes, there is the --karma-config option, which allows one to specify the karma configuration file to use. |
Yes, fortunately we can use |
Agreed, I don't want to have to maintain two different karma configs just to pick a different reporter in our CI build. And where is this in the release notes? I can't find anywhere this info was broadcast, and it's kind of a big deal when all our CI builds silently stop publishing test results 😠 |
I agree with your concern about maintenance. I've had a go at writing another karma configuration file just for ci (I'm using Circleci). Repeating the contents of the original file was not difficult but I could not work out a way to import the existing configuration and then override the reporters, which was essentially the behavior of the command line flag when it was available. So one ends up with the same code in two places, which I don't like. |
Is there a way to pass an environment variable in through the command line that would allow us to use it to adjust the logic in the karma.conf.js file? That may be a way to change the reporter used if for example an environment variable like "CI_TEST" was set. |
When using I also had a quick look at the Angular CLI workspace file (angular.json). There are links there to schemas for karma, protractor and tslint. The karma one includes options like this one:
but I don't see In any case, I personally think that using the workspace file might end up being more work than writing a new karma config file (although I haven't attempted it yet). Does anyone know of a way to import the configuration from the default karma.conf.js file into a new file? I am thinking this would reduce the repetition in the new file. |
I have a solution that is a bit of a hack but seems to work well. Basically, it involves inspecting the passed in const isCI = config.browsers[0] === 'PhantomJS'; // Whatever you pass in for CI. You could do a {
// ...
customLaunchers: {
'PhantomJS_CI': {
base: 'PhantomJS'
}
}
} Then use reporters: isCI ? ['teamcity'] : ['progress'] |
This makes me sad. Why can't the solution be we will put it back? It was working just fine. I wanted a different report for my build than my local box. COME ON MAN!!!!!! |
I got around this by just creating a karma.conf.js file and a karma-ci.conf.js file, along with a base setup file. package.json
karma.conf.js
karma-ci.conf.js
and then the contents of my original karma.conf.js file karma-base.conf.js
A little bit hacky, but I didn't have to duplicate the entire conf file and can now scale out different test instances rather easily. |
Just get back the --reporters command line arg, it was perfect for CI setups! There is no reason whatsoever to remove it!!! For example, I do not need Cobertura reports during development but I need them in the CI. |
Closing as we mistakenly removed this option, and have added it back. Sorry about that folks. |
@filipesilva It seems that this has been restored in CLI 7, but not CLI 6. Will this be added back to version 6? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
With Angular 5, I was using
ng test --reporters teamcity
command, but it seems that--reporters
option has been removed. How do we set the reporters from the command line now?The text was updated successfully, but these errors were encountered: