运行 rake spec:rcov 时,Rcov 不排除 gem
我使用 Rspec 来开发和测试 Radiant 的自定义扩展。在扩展目录中运行 rake spec:rcov 时,它会运行我的规范文件夹中的所有测试,但会为我包含在 Gemfile 中的所有 gem 生成覆盖文件。我尝试将以下 rcov.opts 文件放入 spec 文件夹中:
--exclude "gems/*"
--rails
但它没有任何区别。
我的宝石:
gem "rails", "2.3.11"
gem "radiant", "0.9.1"
...
group :test do
gem 'cucumber-rails', '0.2.4'
gem 'database_cleaner', '0.4.3'
gem 'webrat', '0.6.0'
gem 'rspec', '1.3.0'
gem 'rspec-rails', '1.3.2'
gem 'shoulda-matchers'
gem 'factory_girl', '1.3.2'
gem 'rcov', '~> 0.9.9'
end
如何强制 rcov 将宝石排除在覆盖范围之外?
(我使用的是 MacOSX、Bundler、RVM)
I use Rspec to develop and test custom extensions for Radiant. When running rake spec:rcov in the extension dir, it runs all tests from my spec folder but generates coverage files for all gems that I have included within my Gemfile. I tried putting the following rcov.opts file into the spec folder:
--exclude "gems/*"
--rails
but it does not make any difference.
My Gems:
gem "rails", "2.3.11"
gem "radiant", "0.9.1"
...
group :test do
gem 'cucumber-rails', '0.2.4'
gem 'database_cleaner', '0.4.3'
gem 'webrat', '0.6.0'
gem 'rspec', '1.3.0'
gem 'rspec-rails', '1.3.2'
gem 'shoulda-matchers'
gem 'factory_girl', '1.3.2'
gem 'rcov', '~> 0.9.9'
end
How can I force rcov to exclude gems from coverage?
(I am on MacOSX, Bundler, RVM)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
--exclude 'gems\/'
而不是'gems/*'
。--exclude
选项采用正则表达式或逗号分隔的正则表达式列表,而不是您尝试过的全局模式。Try using
--exclude 'gems\/'
instead of'gems/*'
.The
--exclude
option takes a regular expression or a comma separated list of regular expressions, not a glob pattern as you have tried.