admin管理员组文章数量:1335104
How to get Karma html reporter working in karma conf?
To run my unit tests I type: "npm run test" and the tests run fine in git bash. But I want to see them in the reporter.html file.
I've made a reporter.html file next to the karma conf file in the root directory. The reporter.html file has nothing in it.
I think the reporter.html file gets populated when I run npm run tests and the reporter html page shows up. But this doesn't happen.
This is the link to the bit bucket repo: /
This is my karma conf:
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
})
}
How to get Karma html reporter working in karma conf?
To run my unit tests I type: "npm run test" and the tests run fine in git bash. But I want to see them in the reporter.html file.
I've made a reporter.html file next to the karma conf file in the root directory. The reporter.html file has nothing in it.
I think the reporter.html file gets populated when I run npm run tests and the reporter html page shows up. But this doesn't happen.
This is the link to the bit bucket repo: https://bitbucket/snproject/
This is my karma conf:
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
})
}
Share
Improve this question
edited Dec 8, 2015 at 10:03
AngularM
asked Dec 8, 2015 at 9:53
AngularMAngularM
16.6k29 gold badges102 silver badges175 bronze badges
2 Answers
Reset to default 2karma-html-reporter generates results in 'outputDir' relative to working directory instead of relative to the 'basePath' of karma.conf.js
My problem was solved by using kamra-htmlfile-reporter which correctly generated results at 'outputFile' path relative to the 'basePath'.
If you refer to the karma-html-reporter page, you can see that outputFile
is not one of the options the reporter gets.
Apparently, you don't get to decide about the name of the output file. You can decide where you want the results to be saved. By default, the reporter creates a folder named karma_html
, in which for every browser/OS a folder is created with an index.html
file, which contains the test results.
Looking at your repo, it looks like this folder was created (and you even mitted it...), so everything works.
本文标签: javascriptHow to get Karma html reporter working in karma confStack Overflow
版权声明:本文标题:javascript - How to get Karma html reporter working in karma conf? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742375561a2463091.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论