How to solve Reporter "spec" does not exist in Karma?

I have a project that uses generator-angular

version 0.3.0

and I am trying to add a reporter spec

to its karma checks, but I keep gettingReporter "spec" does not exists in karma

After reading some resources, I did the following steps

  • executed the command npm install karma-spec-reporter --save-dev

  • I changed karma config file (added "spec")

    reporters = ['progress','dots','junit','spec'];

  • I ran grunt

    (which in turn launches karma

    ) and got the error

How can I get the reporter specifier to work in my environment?

+3


source to share


3 answers


If anyone is facing this problem, one of the solutions to this problem is to renew karma. I don't know if there is a solution for the version I was using (I don't know which version it was, sorry), but as soon as I updated the version it worked fine.

One of the markers to make sure karma is up to date is the need for the config file to be in the following format.



module.exports = function(config){
    config.set({
         //... the usual configuration converted from a=b to a:b
         reporters : ['spec'],// -- now this works well.. finally :) 
         //... some more configuration

    });
}

      

The update went pretty smoothly. no big surprises. I recommend updating.

0


source


Go to the same thing today and what worked for me was setting up a karma spec reporter around the world.



I already worked on a project on one PC and did --save-dev

when the reporter was installed on that machine. As soon as I pulled the project to a different machine, I assumed that the execution npm install

had just worked. This is not the case and I was getting the same error. Execution npm i karma-spec-runner --save-dev

didn't work either (even after restarting the shell) and then I tried npm i -g karma-spec-runner

it and it worked.

+1


source


Just ran into the same problem.

It turns out to be fixed by uploading the plugin, but the user manual on NPM and github for some Karma plugins doesn't mention this anywhere.

       plugins: ['karma-chrome-launcher', 'karma-jasmine', 'karma-coverage', 'karma-browserify', 'karma-spec-reporter'],

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['coverage', 'progress', 'spec'],

      

Update: There is a new version of this plugin that will tell you to download it.

https://www.npmjs.com/package/karma-spec-reporter-2

+1


source







All Articles