Search code examples
xmlxsltjenkinskarma-runnerqunit

Better looking QUnit test report with Karma JS


I created a test environment where I use Karma JS to run my QUnit tests and JUnit plugin for Karma to export the test results into xml format for Jenkins. All works well and viewing the tests in Jenkins is ok but what happens when i run Karma locally and I want to see test results without Jenkins? Yes I can view the xml reports in browser, even with XSL viewer but I would like to see them better formatted.

Any good reporter for Karma that works with QUnit, maybe view the result in html format?


Solution

  • Not sure what I was thinking when I asked the question but Karma creates browser windows at runtime and loads tests including necessary html container inside of the browsers. Using these settings in karma.conf.js I can see the QUnit tests as they are printed when run separately.

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,
    
    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity,
    
    // client configuration
    client: {
      clearContext: false,
      qunit: {
        showUI: true,
        testTimeout: 5000,
        filter: 'getColor(colorType, hashColor)'// name of the QUnit module to show logs on only.
      }
    }
    

    karmajs and qunit run locally

    I suppose this will be enough to do my tests locally. The bad thing is, I have to close Karma in order to load different configuration, for example filter tests for a specific function.