Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma custom test page

Karma has a built-in context.html file that loads up the test page. But it sucks. Can I specify a custom test page?

The reason I am asking is because I want to see the mocha pretty interface on the browser. Is there a way to insert that with Karma?

Testem displays the test framework's interface on the browser; is there a reason why Karma displays nothing but an ugly blank page?

@stackoverflow = are you happy now?yes:no
stackoverflow = happy now?ok:thanks
like image 260
eguneys Avatar asked Jul 22 '14 22:07

eguneys


People also ask

How do I use custom browser script with karma?

Simply add the browsers you would like to capture into the configuration file. Then, Karma will take care of auto-capturing these browsers, as well as killing them after the job is over.

What is the difference between Jasmine and karma?

Jasmine is the framework we are going to use to create our tests. It has a bunch of functionalities to allow us the write different kinds of tests. karma. Karma is a task runner for our tests.

What is singleRun in karma?

The property singleRun controls how Karma executes, if set to true , Karma will start, launch configured browsers, run tests and then exit with a code of either 0 or 1 depending on whether or not all tests passed.


1 Answers

Since your posting, Karma has added an option to specify a custom HTML file. The property is called customContextFile

example

module.exports = {
  config.set({
        basePath: './',
        frameworks: ['jasmine'],
        reporters: ['dots'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        browserNoActivityTimeout: 100000,
        plugins: [
            'karma-chrome-launcher',
            'karma-jasmine'
        ],     
        customContextFile: 'specRunner.html',
        files: [
            {
                pattern: 'dist/tests/*.specs.js',
                served: true,
                watched: true
            }
        ]
    })
}

read more

pull request - https://github.com/karma-runner/karma/pull/1825

docs - http://karma-runner.github.io/1.0/config/configuration-file.html#

like image 171
user2954463 Avatar answered Sep 23 '22 02:09

user2954463