在浏览器上显示业力测试

display karma tests on browser

我是 karma 单元测试的新手 angular。我测试了 angular-socket-io 应用程序。这是我在控制台上 运行 karma start 时看到的。

21:58 /tmp/angular-socket-io $ karma start
INFO [karma]: Karma v0.10.10 server started at http://localhost:9999/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 40.0.2214 (Mac OS X 10.8.3)]: Connected on socket AOee3c4IW51Z30jfShdU
Chrome 40.0.2214 (Mac OS X 10.8.3): Executed 18 of 18 SUCCESS (4.393 secs / 0.083 secs)
INFO [Chrome 40.0.2214 (Mac OS X 10.8.3)]: Connected on socket IMCGlDXZwhJJ8Y6YShdV
Chrome 40.0.2214 (Mac OS X 10.8.3): Executed 18 of 18 SUCCESS (0.159 secs / 0.09 secs)
Chrome 40.0.2214 (Mac OS X 10.8.3): Executed 18 of 18 SUCCESS (0.249 secs / 0.093 secs)
TOTAL: 36 SUCCESS

我想在我的 Chrome 浏览器上查看所有测试。这可能吗?

如果您愿意打开 Karma 为您生成的 HTML 报告,请查看 karma-html-reporter。只需将其添加到您的 Karma 配置中的记者列表中即可:

{
  // much more before this

  reporters: ['progress', 'html'],

  // the default configuration
  htmlReporter: {
    outputDir: 'karma_html', // where to put the reports 
    templatePath: null, // set if you moved jasmine_template.html
    focusOnFailures: true, // reports show failures on start
    namedFiles: false, // name files instead of creating sub-directories
    pageTitle: null, // page title for reports; browser info by default
    urlFriendlyName: false // simply replaces spaces with _ for files/dirs

    // experimental
    preserveDescribeNesting: false, // folded suites stay folded 
    foldAll: false, // reports start folded (only with preserveDescribeNesting)
  }

  // much more after this
}