Open Karma-Jasmine debug.html page on startup and automatically refresh it.

/ September 30, 2018/ Javascript, Karma/Jasmine, Unit Tests

(Last Updated On: October 7, 2018)

Sweet sweet Karma…

One of the things I found it more frustrating while learning to use Javascript Test Frameworks pack Karma / Jasmine was that the debug.html file (karma-jasmine-html-reporter) did not open up by default and that it does not refresh it self when the source files changes.

Karma context

So a quick workaround for this is to add a init file in your context and open it up using old plain javascript.

Ad:


ssd-refresh-debug.js

(function (window) {
    if (window.location.pathname === '/context.html') {
        window.open('/debug.html', 'debugTab');
    }
})(window)

karma.conf.js

...
files: [
    './ssd-refresh-debug.js',
...

That will open automatically the debug view on each context update. No plugins required.

Ad:


Spread the love

Leave a Reply

avatar
  Subscribe  
Notify of