多个HTML记者Karma测试运行器

尼基尔·莫蒂亚尼(Nikhil Motiani)

我在Jasmine框架上使用Karma测试运行程序。我正在尝试使用以下记者。但是我不能同时使用两者,有人可以帮我吗?

Karma-html-reporter有助于生成测试用例的HTML报告,而karma-jasmine则在浏览器中美化测试用例。

我认为问题在于两者的命名,

reporters: ["html"]

用于...有人可以建议一些使两者都起作用的方法。

这是我的Karma.conf.js

module.exports = function (config) {

  config.set({
    // base path that will be used to resolve all patterns (eg. files, exclude)
    "basePath": ".",

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    "frameworks": ["jasmine", "sinon"],

    // list of files / patterns to load in the browser
    "files": ["dest/assets/test/myfile.debug.js", "test/**/help*.js",
              "test/**/test*.js"],

    // list of files to exclude
    "exclude": [],

    // Reporters to use
    "reporters": ["nyan", "html"],

    // Configurations for Coverage Reporter
    "coverageReporter": {
      "dir": "coverage/",
      "reporters": [
        {"type": "html", "subdir": "CoverageReportHTML"},
        {"type": "text", "subdir": ".", "file": "coverage.txt"}
      ]
    },

    // Configurations for HTML Reporter
    "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
      "reportName": "report-summary" // report summary filename; browser info by default
    },

    // Karma Webserver port
    "port": 9999,

    // enable / disable colors in the output (reporters and logs)
    "colors": true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    "logLevel": config.LOG_ERROR,

    // enable / disable watching file and executing tests whenever any file changes
    "autoWatch": true,

    // Custom Launchers / Browsers Configurations
    "customLaunchers": {
      "IE10": {"base": "IE", "x-ua-compatible": "IE=EmulateIE10"},
      "IE9": {"base": "IE", "x-ua-compatible": "IE=EmulateIE9"},
      "IE8": {"base": "IE", "x-ua-compatible": "IE=EmulateIE8"},
      "IE7": {"base": "IE", "x-ua-compatible": "IE=EmulateIE7"}
    },

    // Browsers to Launch - Available launchers: https://npmjs.org/browse/keyword/karma-launcher
    "browsers": ["Chrome", "Firefox"],
    // browsers: ["Chrome", "Safari", "IE", "Firefox", "IE8","IE9", "IE10"],
    // if true, Karma captures browsers, runs the tests and exits (Keep false for CI)
    "singleRun": true
  });
};
Healforgreen

TLDR:我提交了一个拉取请求,但是不确定何时会被查看。目前,请卸载当前版本karma-jasmine-html-reporter并运行npm install Nocomm/karma-jasmine-html-reporter --save-dev

这样使用: reporters: ['kjhtml', 'html']

---------------------------------------

您肯定可以,我将提交拉取请求,以使两者不会发生冲突。现在,您可以编辑karma-jasmine-html-reporter\src\index.js文件的最后一行

module.exports = {
  'reporter:kjhtml': ['type', initReporter]
};

只需更改'reporter:html''reporter:kjhtml',然后反映出您在业力配置文件中定义报告器的位置。他们两个现在应该并排工作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

尝试运行Karma测试运行程序时未定义JASMINE

来自分类Dev

如何强制Google基准测试运行多个迭代?

来自分类Dev

MAVEN:使用Maven测试运行多个Maven项目

来自分类Dev

业力测试运行器-无法捕获Chrome

来自分类Dev

是否有PHPUnit的分层测试运行器?

来自分类Dev

业力测试运行器-无法捕获Chrome

来自分类Dev

测试运行器在重播期间找不到控件

来自分类Dev

为什么我的AngularJS,Karma / Jasmine测试运行如此缓慢?

来自分类Dev

Grunt + Karma测试运行程序失败,并显示“ ReferenceError:未定义模块”

来自分类Dev

Karma测试运行程序中的全局变量

来自分类Dev

karma / angularjs如何使用异步服务测试运行块

来自分类Dev

着色golang测试运行输出

来自分类Dev

作为Maven测试运行

来自分类Dev

再现ScalaCheck测试运行

来自分类Dev

Couchbase测试运行失败

来自分类Dev

Intellij测试运行历史

来自分类Dev

测试运行null和字母?

来自分类Dev

Serverspec测试运行问题

来自分类Dev

使用JUNIT测试运行AsyncHttpClient

来自分类Dev

在测试运行期间浏览

来自分类Dev

使用R#测试运行器运行ReSharper插件测试

来自分类Dev

通过VSTS中的命令行测试运行器发布测试结果

来自分类Dev

使用业力测试运行器进行多种聚合物元素测试

来自分类Dev

使用业力测试运行器进行多种聚合物元素测试

来自分类Dev

使用Python中的绿色测试运行器跳过测试

来自分类Dev

使用测试运行器来测试操作 DOM 的函数

来自分类Dev

邮差收集运行器-如何保存测试运行,以便稍后将其重新导入

来自分类Dev

在Azure DevOps中运行.Net / VS测试运行器失败

来自分类Dev

邮差收集运行器-如何保存测试运行,以便稍后将其重新导入

Related 相关文章

热门标签

归档