2017-01-09 19:04:04 -05:00
|
|
|
unless Rails.env.production?
|
|
|
|
namespace :karma do
|
|
|
|
desc 'GitLab | Karma | Generate fixtures for JavaScript tests'
|
2017-03-22 22:39:09 -04:00
|
|
|
RSpec::Core::RakeTask.new(:fixtures, [:pattern]) do |t, args|
|
|
|
|
args.with_defaults(pattern: 'spec/javascripts/fixtures/*.rb')
|
2017-01-09 19:04:04 -05:00
|
|
|
ENV['NO_KNAPSACK'] = 'true'
|
2017-03-22 22:39:09 -04:00
|
|
|
t.pattern = args[:pattern]
|
2017-01-09 19:04:04 -05:00
|
|
|
t.rspec_opts = '--format documentation'
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'GitLab | Karma | Run JavaScript tests'
|
2017-02-15 15:18:21 -05:00
|
|
|
task tests: ['yarn:check'] do
|
2017-02-07 17:57:43 -05:00
|
|
|
sh "yarn run karma" do |ok, res|
|
2017-01-09 19:04:04 -05:00
|
|
|
abort('rake karma:tests failed') unless ok
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
|
2017-02-15 15:18:21 -05:00
|
|
|
task karma: ['karma:fixtures', 'karma:tests']
|
2017-01-09 19:04:04 -05:00
|
|
|
end
|