Webmock interferes with coverage transmission
otupman opened this issue · 3 comments
Code coverage transmission gets interfered with by HTTP mocking frameworks such as Webmock.
Delightfully, Coveralls have a workaround that can be used:
WebMock.disable_net_connect! allow: %w{codecov.io}
I feel it's probably something worth mentioning on the documentation, if only to save others the few minutes of Googling I did to find that workaround!
Thank you @otupman, is this something I can add to the code base? Or just documentation.
Hmm, good question. That particular line itself is purely for documentation purposes, however Coveralls also have a built-in fix for it:
if defined?(WebMock) &&
allow = WebMock::Config.instance.allow || []
WebMock::Config.instance.allow = [*allow].push API_HOST
end
if defined?(VCR)
VCR.send(VCR.version.major < 2 ? :config : :configure) do |c|
c.ignore_hosts API_HOST
end
end
The coveralls-ruby license is MIT, so making use of that should be fine.
I've optimistically forked the code base, so I might submit a fix for it - but no promises, right now I've weirdly got two failing tests: the one I've added for webmock but also test_werkcer
. Does testunit
run tests in parallel?
Thanks for the snippit - I'll add it to the code base soon or you can contribute it :) I'm not sure about the testunit
running parallel... Are my tests failing?