Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular test reporting options?

I find the Angular console test reporting awkward to read, it just a big pile of console text with next to no formatting.

Is it possible to get the Angular unit testing reporting to appear in the browser using html for formatting? I noticed this github repo the other day - https://github.com/larrymyers/jasmine-reporters

  • Is it possible to use the html reporter in that library for Angular unit test reporting..can I have the results of Angular unit tests shown in a browser?

I know there is a 'reporters' config option in the karma test runner file used for Angular testing and it has the following options - dots, progress, junit, growl, coverage

However these seem to do absolutely nothing, no matter what I set them to, and I couldn't find any documentation on them.

  • So what is the purpose of the reporters option in karma.conf.js?

like image 212
sonicboom Avatar asked Aug 16 '26 06:08

sonicboom


1 Answers

I run karma from IntelliJ 13.x and am able to get a clean html format for the test output using the following configuration options in karma.conf.js in the config.set section :

    reporters: ['progress', 'junit', 'html']
    plugins : ['karma-htmlfile-reporter', ...] (karma-jasmine, etc...)
    htmlReporter: { outputFile: 'tests/units.html' }

After my tests run I can just right click on the test/units.html and open in browser to see a formatted version of the results including color coding of results. Of course you will need to install any plugins or dependencies to get the test to run.

like image 100
bchesley Avatar answered Aug 20 '26 06:08

bchesley