rake
rake copied to clipboard
Rake FileList doesn't resolve paths inside namespace
Faced this issue in Windows. Haven't tried it on Linux.
In the following, the test files don't get picked up.
namespace :app do
task :test do
Rake::TestTask.new do |t|
t.libs << "tests"
t.test_files = FileList["server/tests/ts_*.rb"]
end
end
end
However, from inside the 'server' folder, this works perfectly fine -
task :test do
Rake::TestTask.new do |t|
t.libs << "tests"
t.test_files = FileList["tests/ts_*.rb"]
end
end
Am I doing something wrong? I tried many different variations but couldn't get it to work at all.
Hi, I cannot explain about it well, But I wrote codes with two ways. Please try it.
namespace :app do
Rake::TestTask.new(:test) do |t|
t.libs << "tests"
t.test_files = FileList["server/tests/ts_*.rb"]
end
end
Rake::TestTask.new('app:test') do |t|
t.libs << "tests"
t.test_files = FileList["server/tests/ts_*.rb"]
end
I hope this will be of some help.
This did work although now I can't add description for the specific task.
How I ended up resolving it was creating another rakefile under 'server' by a different name - 'raketest' and called that from my parent rakefile -
namespace :app do
desc "to test all apis"
task :test do
Dir.chdir 'server' do
puts `rake -f raketest.rb test`
end
end
end