Skip to content
7rans edited this page Apr 5, 2014 · 3 revisions

Tapout with Rake

To use tapout with Rake's test task, you need to instruct Rake to use TAP-Y/J output. This can be done with the TESTOPTS environment variable. Also you need to make sure that Rake suppresses all extraneous output. This can be done with the -q flag.

$ TESTOPTS="- --tapy" rake -q test

Most likely you want to pass the output to tapout automatically. Conveniently Rake's test task allows us to append a piped command to the TESTOPTS environment variable.

$ TESTOPTS="- --tapy | tapout" rake -q test

Of course, who wants to type this all the time. Instead we can modify the options in the Rakefile:

  Rake::TestTask.new do |t|
    t.libs << "lib"
    t.libs << "test"
    t.test_files = FileList['test/test*.rb']
    t.verbose = false
    t.options = "- --tapy | tapout"
  end

The verbose property serves the same purpose as -q on the command line and the options property is the same as the TESTOPTS environment variable. In order to adjust the tapout format you could use a ENV['rpt'], e.g.

    t.options = "- --tapy | tapout #{ENV['rpt']}"

Then on the command line:

$ rpt=progress rake test

There's probably a number of ways to approach this problem. If you have any alternative suggestions, please let us know!

Clone this wiki locally