【发布时间】:2015-12-08 09:53:05
【问题描述】:
如何让 Karma html 记者在 karma conf 中工作?
要运行我的单元测试,我输入:“npm run test”,测试在 git bash 中运行良好。 但我想在reporter.html 文件中看到它们。
我在根目录中的 karma conf 文件旁边创建了一个reporter.html 文件。 Reporter.html 文件中没有任何内容。
我认为,当我运行 npm run tests 并显示记者 html 页面时,reporter.html 文件会被填充。但这不会发生。
这是位桶回购的链接:https://bitbucket.org/snproject/
这是我的因果报应:
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/testing.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true},
{pattern: 'node_modules/angular2/bundles/http.js', included: true, watched: true},
{pattern: 'src/firebase/firebase.js', included: true, watched: true},
{pattern: 'karma-test-shim.js', included: true, watched: true},
{pattern: 'src/**/*.js', included: false, watched: true},
{pattern: 'src/**/*.html', included: false, watched: true},
{pattern: 'src/**/*.css', included: false, watched: true},
{pattern: 'src/**/*.ts', included: false, watched: false},
{pattern: 'src/**/*.js.map', included: false, watched: false}
],
proxies: {
"/app/": "/base/src/app/"
},
reporters: ['progress', 'html'],
//This doesnt seem to work or show up????
htmlReporter: {
outputFile: 'reporter.html'
},
port: 9877,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
})
}
【问题讨论】:
标签: javascript git unit-testing karma-runner karma-jasmine