From 5e42ca3631eec413d83a03a86d981bce0094ffff Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen <gavin.didrichsen@gmail.com> Date: Wed, 15 Jan 2025 09:55:13 +0000 Subject: [PATCH] Add testing flexibility Prior to this commit all bolt tests had to be run in order to check a small change. This commit allow individual tests to be re-run to shorten the dev iteration cycle. Signed-off-by: Gavin Didrichsen <gavin.didrichsen@gmail.com> --- rakelib/tests.rake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rakelib/tests.rake b/rakelib/tests.rake index 5ebaedf149..e570e5bafd 100644 --- a/rakelib/tests.rake +++ b/rakelib/tests.rake @@ -15,7 +15,14 @@ begin desc "Run RSpec tests that do not require VM fixtures or a particular shell" RSpec::Core::RakeTask.new(:unit) do |t| - t.pattern = "spec/unit/**/*_spec.rb" + if ENV['TEST'] + t.pattern = "spec/unit/**/*_spec.rb" + t.rspec_opts = "-e '#{ENV['TEST']}'" + elsif ENV['FILE'] + t.pattern = ENV['FILE'] + else + t.pattern = "spec/unit/**/*_spec.rb" + end end desc 'Run tests that require a host System Under Test configured with WinRM'