BigW Consortium Gitlab

karma.rake 694 Bytes
Newer Older
1 2 3
unless Rails.env.production?
  namespace :karma do
    desc 'GitLab | Karma | Generate fixtures for JavaScript tests'
4 5
    RSpec::Core::RakeTask.new(:fixtures, [:pattern]) do |t, args|
      args.with_defaults(pattern: 'spec/javascripts/fixtures/*.rb')
6
      ENV['NO_KNAPSACK'] = 'true'
7
      t.pattern = args[:pattern]
8 9 10 11
      t.rspec_opts = '--format documentation'
    end

    desc 'GitLab | Karma | Run JavaScript tests'
12
    task tests: ['yarn:check'] do
13
      sh "yarn run karma" do |ok, res|
14 15 16 17 18 19
        abort('rake karma:tests failed') unless ok
      end
    end
  end

  desc 'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
20
  task karma: ['karma:fixtures', 'karma:tests']
21
end