angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular CLI: 6.0.1 - unable to generate JUnit report - Unknown option --reporters

Open rgierczak opened this issue 8 years ago • 6 comments

After upgrading Angular and Angular CLI to lastest varsion, it is unable to generate JUnit test report. With previous Angular version it was possible to create unit tests report correctly.

I would like to ask for fix that issue.

Versions

npm: 6.0.1

Angular CLI: 6.0.1
Node: 8.11.1
OS: linux x64
Angular: 6.0.1
... cli, common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1 (cli-only)
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.1 (cli-only)
@schematics/update                0.6.1 (cli-only)
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

run command on ng test --reporters junit

Observed behavior

Unknown option '--reporters'

Desired behavior

The report with unit tests results should be created.

Mention any other details that might be useful (optional)

I have a karma junit installed in project, taken from here: https://github.com/karma-runner/karma-junit-reporter

I'm providing below my karma.conf.js file structure:

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('@angular-devkit/build-angular/plugins/karma'),
      require('karma-junit-reporter')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: ['progress', 'junit'],
    junitReporter: {
      outputDir: 'reports', // results will be saved as $outputDir/$browserName.xml
      outputFile: 'junit.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
      useBrowserName: false // add browser name to report and classes names
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};

rgierczak avatar May 14 '18 08:05 rgierczak

Hi,

In your Karma configuration file I see that junit is included as one of your reporters. If you run ng test without the --reporters flag does it produce the junit test report as junit.xml?

cheers Charlie

CharlesSuttie avatar May 21 '18 10:05 CharlesSuttie

Hello Charles,

Yes, when I remove --reporters flag from the ng test commnad, the junit report is being produced correctly.

rgierczak avatar May 22 '18 12:05 rgierczak

Hi,

It seems that the --reporters option has been removed from the ng test command. Another way to specify which reporters to use is to write a separate karma configuration file and then use the --karma-config option.

You might also have seen issue #10852, where it is asked whether there are other ways to specify the reporters, without the need to write a new configuration file. I don't see a way to do this in the documentation, however.

cheers Charlie

CharlesSuttie avatar May 22 '18 12:05 CharlesSuttie

Yes, I've seen the equivalent issue about the touched case. Thank you very much for your clarification.

Best regards, Rafał

rgierczak avatar May 22 '18 13:05 rgierczak

Duplicate of https://github.com/angular/angular-cli/issues/10852

alan-agius4 avatar Jan 04 '19 12:01 alan-agius4

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.