File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,39 @@ Bundler.setup
99require 'bundler/gem_tasks'
1010require "cucumber/rake/task"
1111require "rspec/core/rake_task"
12+ require 'rake/clean'
13+
14+ # Work around a bug in `rake/clean` from `rake` versions older than 13. It's
15+ # failing when it calls `FileUtils::rm_r` because that method needs to receive
16+ # the `opts` parameter as parameters instead of as a `Hash`.
17+ module Rake
18+ module Cleaner
19+ module_function
20+
21+ def cleanup ( file_name , **opts )
22+ begin
23+ opts = { verbose : Rake . application . options . trace } . merge ( opts )
24+ rm_r file_name , **opts
25+ rescue StandardError => ex
26+ puts "Failed to remove #{ file_name } : #{ ex } " unless file_already_gone? ( file_name )
27+ end
28+ end
29+ end
30+ end
31+
32+ # Remove the `coverage` directory when the `:clobber` task is run.
33+ CLOBBER . include ( 'coverage' )
1234
1335Cucumber ::Rake ::Task . new do |t |
1436 t . cucumber_opts = %w( --format progress )
1537end
1638
1739RSpec ::Core ::RakeTask . new ( 'spec' )
1840
41+ # Run the `clobber` task when running the entire test suite, because the
42+ # coverage information reported by `simplecov` can be skewed when a `coverage`
43+ # directory is already present.
1944desc "Run the whole test suite."
20- task test : [ :spec , :cucumber ]
45+ task test : [ :clobber , : spec, :cucumber ]
2146
2247task default : :test
You can’t perform that action at this time.
0 commit comments