angularkarma-jasmineangular-clijasmine-reporters

angular cli ng test : Can not load reporter "", it is not registered


I am trying the following command from https://cli.angular.io/reference.pdf

ng test --reporters

The following error is showing. Please tell me how to register reporter.

05 01 2017 12:47:19.437:ERROR [reporter]: Can not load reporter "", it is not re
gistered!
  Perhaps you are missing some plugin?
05 01 2017 12:47:44.876:WARN [karma]: No captured browser, open http://localhost
:9876/
05 01 2017 12:47:44.894:INFO [karma]: Karma v1.2.0 server started at http://loca
lhost:9876/
05 01 2017 12:47:44.895:INFO [launcher]: Launching browser Chrome with unlimited
 concurrency
05 01 2017 12:47:44.897:ERROR [karma]: Found 1 load error

Solution

  • I have able to figure out how to use reporters in angular-cli

    I have updated the Karma configuration file (karma.conf.js) as follows

    require('karma-jasmine-html-reporter'),
    

    and

    reporters: config.angularCli && config.angularCli.codeCoverage
                  ? ['progress', 'karma-remap-istanbul', 'kjhtml']
                  : ['progress', 'kjhtml'],
    

    Then run the following command to install the plugin

    npm install karma-jasmine-html-reporter --save-dev
    

    then I run

    ng test --code-coverage
    

    It is giving me a report like this this