Karma custom test page
Asked Answered
D

1

8

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
Disrepair answered 22/7, 2014 at 22:13 Comment(0)
M
5

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#

Murmurous answered 27/4, 2017 at 16:35 Comment(2)
Are there any documentations about the rules for customizing a context file?Phonolite
I don't see anything in the docs about rules for customizing a context file. You could view an example by looking at karma's own context.html file. I get the sense that most people do not use this config option. github.com/karma-runner/karma/blob/master/static/context.htmlMurmurous

© 2022 - 2024 — McMap. All rights reserved.