Rakefile and simplecov

Content preview: Hi, I’ve a Rakefile generated by jeweler. It uses rcov
default
but that doesn’t properly work with 1.9 (I’m using 1.9.2), so I’d
like to
enable simplecov for my tests. I’ve used simplecov successfully
without a
Rakefile. […]

Content analysis details: (-2.9 points, 5.0 required)

pts rule name description



-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
X-Cloudmark-Analysis: v=1.1
cv=JvXQbuMnWGQeb488dJ7w43Du7THgE+O7ieb9U20/rjk= c=1 sm=0
a=aofHTkXiRO8A:10 a=8nJEP1OIZ-IA:10 a=xqWC_Br6kY4A:10
a=jQiSh5ylwdJ48oZKAz8A:9 a=wPNLvfGTeEIA:10
a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Precedence: bulk
Lines: 33
List-Id: ruby-talk.ruby-lang.org
List-Software: fml [fml 4.0.3 release (20011202/4.0.3)]
List-Post: mailto:[email protected]
List-Owner: mailto:[email protected]
List-Help: mailto:[email protected]?body=help
List-Unsubscribe: mailto:[email protected]?body=unsubscribe
Received-SPF: none (Address does not pass the Sender Policy Framework)
SPF=FROM;
[email protected];
remoteip=::ffff:221.186.184.68;
remotehost=carbon.ruby-lang.org;
helo=carbon.ruby-lang.org;
receiver=eq4.andreas-s.net;

Hi,

I’ve a Rakefile generated by jeweler. It uses rcov default but that
doesn’t properly work with 1.9 (I’m using 1.9.2), so I’d like to enable
simplecov for my tests. I’ve used simplecov successfully without a
Rakefile.

I added

gem “simplecov”, “>= 0.4.0”

to Gemfile and modified the test task:

require ‘rake/testtask’
require ‘simplecov’
Rake::TestTask.new(:test) do |test|
SimpleCov.start do
add_filter ‘test_’
end
test.libs << ‘lib’ << ‘test’
test.pattern = ‘test/**/test_*.rb’
test.verbose = true
end

simplecov is executed, but doesn’t record anything:

Coverage report generated for rake to coverage. 0 / 0 LOC (0.0%)
covered.

As far as I can see, simplecov doesn’t provide a ready rake task, how
can I use it in this case? I’ve gone through the rake documentation but
didn’t spot anything obvious I’m missing.

thanks,

  • Markus

I’m not super familiar with simplecov, but i just merged a patch that
implements it on one of my projects this morning:

Hope that helps you? It runs the coverage report on every task, though.

Content preview: On 18.04.2011 18:11, Steve K. wrote: > I’m not
super
familiar with simplecov, but i just merged a patch that > implements
it on
one of my projects this morning: > >

> > Hope that helps you? It runs the coverage report on every task,
though.
[…]

Content analysis details: (-2.9 points, 5.0 required)

pts rule name description



-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
X-Cloudmark-Analysis: v=1.1
cv=HQ3F56nxkum+cgCiDL7AXQpbvw7DWrWCBJRnYYnM0Zc= c=1 sm=0
a=svAFAT5c7LwA:10 a=8nJEP1OIZ-IA:10 a=NEAV23lmAAAA:8
a=vyDOETw-HOAD_cEZXdQA:9 a=wPNLvfGTeEIA:10
a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Precedence: bulk
Lines: 38
List-Id: ruby-talk.ruby-lang.org
List-Software: fml [fml 4.0.3 release (20011202/4.0.3)]
List-Post: mailto:[email protected]
List-Owner: mailto:[email protected]
List-Help: mailto:[email protected]?body=help
List-Unsubscribe: mailto:[email protected]?body=unsubscribe
Received-SPF: none (Address does not pass the Sender Policy Framework)
SPF=FROM;
[email protected];
remoteip=::ffff:221.186.184.68;
remotehost=carbon.ruby-lang.org;
helo=carbon.ruby-lang.org;
receiver=eq4.andreas-s.net;

On 18.04.2011 18:11, Steve K. wrote:

I’m not super familiar with simplecov, but i just merged a patch that
implements it on one of my projects this morning:

Hope that helps you? It runs the coverage report on every task, though.

Thanks, that helped at least get some result. However the coverage
itself is wrong, it’s not 12.8% (80/625 LOC), when the real coverage
(standalone without rake) is 597 / 626 LOC (95.37%).

Without the Rakefile, all I do is

$ cat mylib_simplecov.rb
require ‘simplecov’
SimpleCov.start do
add_filter ‘_test’
end
require_relative ‘mylib_test’

and mylib_test starts with

$ head mylib_test.rb
require ‘test/unit’
require_relative ‘mylib’

module MylibTests
class Misc < Test::Unit::TestCase

and that’s all and it works.

I thought moving to jeweler and all the other stuff makes things easier,
but currently it made it just harder :confused:

  • Markus