Unit testing code coverage : unable to change the reporter to JUnit
See original GitHub issueBug Report or Feature Request (mark with an x)
- [X] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.1.0
Repro steps.
Change the karma.conf.js file as follows :
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
// require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'),
require('karma-junit-reporter'),
require('@angular/cli/plugins/karma')
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts', 'tsx']
},
junitReporter: {
outputDir: 'coverage', // results will be saved as $outputDir/$browserName.xml
useBrowserName: false, // add browser name to report and classes names
outputFile: 'test-report.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: ['junit'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: [
'PhantomJS',
// 'Chrome'
],
singleRun: false
});
};
The log given by the failure.
$ npm run test -- --watch=false --code-coverage
> harfang@0.1.5-SNAPSHOT test D:\mtrichard\harfangv2_frontend
> ng test "--watch=false" "--code-coverage"
10% building modules 1/1 modules 0 active01 06 2017 11:27:42.547:ERROR [reporter]: Can not load reporter "coverage-istanbul", it is not registered!
Perhaps you are missing some plugin?
Desired functionality.
I would like to change the reporter used for the code coverage, but coverage-istanbul is always used, even though I don’t have the package (I removed it from package.json and used npm prune)
Mention any other details that might be useful.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Angular Unit testing : can't change the reporter of karma
The command I use is now ng test --reporters=junit --watch=false || ECHO ... npm install karma-coverage-istanbul-reporter --save-dev.
Read more >Problems with test reports - SonarQube - Sonar Community
Hi, I am writing unit test using google test and generated xml file using mytest --gtest_output=xml:output.xml.
Read more >Configuring Test Coverage - Code Climate
The Code Climate test coverage reporter takes a supported test coverage report, transforms it into a generalized format, and submits it to Code...
Read more >Unit test reports - GitLab Docs
To copy the name of all failed tests, at the top of the Test summary panel, select Copy failed tests. The failed tests...
Read more >mocha-junit-reporter - npm
This will output a results file at ./test-results.xml . You may optionally declare an alternate location for results XML file by setting the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the intel. But I still have one question remaining : what is the point of having those lines
in the
karma.conf.js, if they’re not used ?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.