Skip to content

Commit

Permalink
updated Rakefile
Browse files Browse the repository at this point in the history
Signed-off-by: nikhil2611 <[email protected]>
  • Loading branch information
nikhil2611 committed Jul 12, 2024
1 parent e2eaef9 commit d592dea
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
require 'bundler/gem_tasks'
require "bundler/gem_tasks"

WINDOWS_PLATFORM = %w[x64-mingw32 x64-mingw-ucrt ruby].freeze
WINDOWS_PLATFORM = %w{ x64-mingw32 x64-mingw-ucrt ruby }.freeze

# Style Tests
begin
require 'chefstyle'
require 'rubocop/rake_task'
require "chefstyle"
require "rubocop/rake_task"
RuboCop::RakeTask.new do |t|
t.formatters = ['progress']
t.options = ['-D']
t.formatters = ["progress"]
t.options = ["-D"]
end

# style is an alias for rubocop
task style: :rubocop
rescue LoadError
puts 'ChefStyle not available; disabling style checking tasks'
puts "ChefStyle not available; disabling style checking tasks"
end

# Unit Tests
begin
require 'rspec/core/rake_task'
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new

# Coverage
desc 'Generate unit test coverage report'
desc "Generate unit test coverage report"
task :coverage do
ENV['COVERAGE'] = 'true'
ENV["COVERAGE"] = "true"
Rake::Task[:spec].invoke
end
rescue LoadError
puts 'RSpec not available; disabling rspec tasks'
puts "RSpec not available; disabling rspec tasks"
# create a no-op spec task for :default
task :spec
end

# Feature Tests
begin
require 'cucumber'
require 'cucumber/rake/task'
require "cucumber"
require "cucumber/rake/task"
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--tags 'not @not-windows'" if RUBY_PLATFORM =~ WINDOWS_PLATFORM || RUBY_PLATFORM =~ /darwin/
if WINDOWS_PLATFORM.include?(WINDOWS_PLATFORM) || RUBY_PLATFORM.match?(/darwin/)
t.cucumber_opts = "--tags 'not @not-windows'"
end
end
rescue LoadError
puts 'Cucumber/Aruba not available; disabling feature tasks'
puts "Cucumber/Aruba not available; disabling feature tasks"
# create a no-op spec task for :default
task :features
end

# test or the default task runs spec, features, style
desc 'run all tests'
task default: %i[coverage features style]
desc "run all tests"
task default: %i{coverage features style}
task test: :default

0 comments on commit d592dea

Please sign in to comment.