summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2023-12-20 03:30:04 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2023-12-20 03:30:04 +0000
commit38e40d5c134662cbfd85e656a628cbbf9397979d (patch)
treec78b2e417a540f6148d91262abe7ff0862d7186f
parentcbe6b4a37485a0fdd93c3439d97c8d17fda163f9 (diff)
downloadredmine-38e40d5c134662cbfd85e656a628cbbf9397979d.tar.gz
redmine-38e40d5c134662cbfd85e656a628cbbf9397979d.zip
Run plugin tests only if test files exist (#39803, #36320).
git-svn-id: https://svn.redmine.org/redmine/trunk@22525 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/tasks/redmine.rake42
1 files changed, 30 insertions, 12 deletions
diff --git a/lib/tasks/redmine.rake b/lib/tasks/redmine.rake
index 63717c503..c2e81053a 100644
--- a/lib/tasks/redmine.rake
+++ b/lib/tasks/redmine.rake
@@ -169,44 +169,62 @@ DESC
desc 'Runs the plugins tests.'
task :test do
- $: << "test"
- Rails::TestUnit::Runner.run_from_rake 'test', FileList[
+ test_files = FileList[
"plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb",
"plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb",
"plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb",
"plugins/#{ENV['NAME'] || '*'}/test/system/**/*_test.rb"
]
+ if test_files.any?
+ $: << "test"
+ Rails::TestUnit::Runner.run_from_rake 'test', test_files
+ end
end
namespace :test do
desc 'Runs the plugins unit tests.'
task :units => "db:test:prepare" do |t|
- $: << "test"
- Rails::TestUnit::Runner.run_from_rake 'test', ["plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"]
+ test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"]
+ if test_files.any?
+ $: << "test"
+ Rails::TestUnit::Runner.run_from_rake 'test', test_files
+ end
end
desc 'Runs the plugins functional tests.'
task :functionals => "db:test:prepare" do |t|
- $: << "test"
- Rails::TestUnit::Runner.run_from_rake 'test', ["plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"]
+ test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"]
+ if test_files.any?
+ $: << "test"
+ Rails::TestUnit::Runner.run_from_rake 'test', test_files
+ end
end
desc 'Runs the plugins integration tests.'
task :integration => "db:test:prepare" do |t|
- $: << "test"
- Rails::TestUnit::Runner.run_from_rake 'test', ["plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"]
+ test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"]
+ if test_files.any?
+ $: << "test"
+ Rails::TestUnit::Runner.run_from_rake 'test', test_files
+ end
end
desc 'Runs the plugins system tests.'
task :system => "db:test:prepare" do |t|
- $: << "test"
- Rails::TestUnit::Runner.run_from_rake 'test', ["plugins/#{ENV['NAME'] || '*'}/test/system/**/*_test.rb"]
+ test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/system/**/*_test.rb"]
+ if test_files.any?
+ $: << "test"
+ Rails::TestUnit::Runner.run_from_rake 'test', test_files
+ end
end
desc 'Runs the plugins ui tests.'
task :ui => "db:test:prepare" do |t|
- $: << "test"
- Rails::TestUnit::Runner.run_from_rake 'test', ["plugins/#{ENV['NAME'] || '*'}/test/ui/**/*_test.rb"]
+ test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/ui/**/*_test.rb"]
+ if test_files.any?
+ $: << "test"
+ Rails::TestUnit::Runner.run_from_rake 'test', test_files
+ end
end
end
end