Karma自定义测试页面

egu*_*eys 7 javascript tdd mocha.js karma-runner testem

Karma有一个内置context.html文件,可以加载测试页面.但它很糟糕.我可以指定自定义测试页吗?

我问的原因是因为我想在浏览器上看到mocha漂亮的界面.有没有办法用Karma插入?

Testem在浏览器上显示测试框架的界面; 有没有理由为什么Karma只显示一个丑陋的空白页?

@stackoverflow = are you happy now?yes:no
stackoverflow = happy now?ok:thanks
Run Code Online (Sandbox Code Playgroud)

use*_*463 5

自您发布后,Karma 已添加一个选项来指定自定义 HTML 文件。该属性被称为customContextFile

例子

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
            }
        ]
    })
}
Run Code Online (Sandbox Code Playgroud)

阅读更多

拉取请求 - https://github.com/karma-runner/karma/pull/1825

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

  • 是否有关于自定义上下文文件的规则的文档? (2认同)