茉莉花与jscoverage自动测试 [英] jasmine with jscoverage automated testing

查看:187
本文介绍了茉莉花与jscoverage自动测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一直在观看jsunit和jcoverage演示此处点击覆盖率报告链接,在新标签中打开此链接)

Had been looking at the jsunit and jcoverage demos here (click on coverage report link. Open this in a new tab).

我想知道有没有人做过类似Jasmine和JSCoverage的事情?

I was wondering if any one had done anything similar with Jasmine and JSCoverage ? I'm a little unsure on how to proceed.


我想知道我是否可以用茉莉花记者做些什么。我的茉莉花hello world例子引用了TrivialReporter。也许这可以延长?

I am wondering if there is something I can do with a jasmine reporter. My Jasmine "hello world" example makes reference to a TrivialReporter. Maybe this can be extended ??


我现在已经连接了js-test-runner和jasmine。现在如果我可以想到一种方法来获取覆盖率。

I've wired up js-test-runner with jasmine right now. Now If I could think of a way to get coverage ??

推荐答案

如果你正在开发一个ruby项目并使用茉莉花通过jasmine-gem,我有一个添加jscoverage支持的补丁[1]。

If you're working on a ruby project and using jasmine via jasmine-gem, I have a patch that adds jscoverage support[1].

如果你使用bundler,可以使用这个版本的jasmine,在您的 Gemfile

If you're using bundler, you can use this version of jasmine with the following command in your Gemfile:

  gem 'jasmine',
    :git        => 'git://github.com/hjdivad/jasmine-gem',
    :submodules => true,
    :branch     => 'jscoverage'

确保您已下载jscoverage并且它在 $ PATH

Make sure you've downloaded jscoverage and it's in your $PATH.

然后,您可以将以下内容添加到 jasmine.yml

You can then add the following to jasmine.yml

coverage:
  enabled:    true
  encoding:   utf-8
  tmp_dir:    tmp
  report_dir: public/coverage
  skip_paths:
    - public/javascripts/vendor

如果这对你有效,你可能想在拉取请求[2]上说出来,得到它或一些变化,进入茉莉花宝石。

If this works for you, you may want to speak up on the pull request[2] to get it, or some variation, into jasmine-gem proper.

  • [1] https://github.com/hjdivad/jasmine-gem/tree/jscoverage
  • [2] https://github.com/pivotal/jasmine-gem/pull/37

这篇关于茉莉花与jscoverage自动测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆