gitlab-org--gitlab-foss/lib/tasks/karma.rake
Yorick Peterse 9e08b71a04
Backport EE changes to the Karma Rake task
There's no harm in globbing for the ee/ directory, since this will
effectively be a noop in CE.
2019-02-28 15:03:10 +01:00

21 lines
704 B
Ruby

unless Rails.env.production?
namespace :karma do
desc 'GitLab | Karma | Generate fixtures for JavaScript tests'
RSpec::Core::RakeTask.new(:fixtures, [:pattern]) do |t, args|
args.with_defaults(pattern: '{spec,ee/spec}/javascripts/fixtures/*.rb')
ENV['NO_KNAPSACK'] = 'true'
t.pattern = args[:pattern]
t.rspec_opts = '--format documentation'
end
desc 'GitLab | Karma | Run JavaScript tests'
task tests: ['yarn:check'] do
sh "yarn run karma" do |ok, res|
abort('rake karma:tests failed') unless ok
end
end
end
desc 'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
task karma: ['karma:fixtures', 'karma:tests']
end