summaryrefslogtreecommitdiff
path: root/lib/tasks/karma.rake
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-01-09 18:04:04 -0600
committerMike Greiling <mike@pixelcog.com>2017-01-10 12:30:41 -0600
commit0e4aaa06d3a83f66a90a6f084efc8742a4221d5f (patch)
tree4f70b1c4755c491f5aa1806eb2af926404dcc8ce /lib/tasks/karma.rake
parentee6de1d34f27fa4e60ab8a493d1b2d6ca997e91e (diff)
downloadgitlab-ce-0e4aaa06d3a83f66a90a6f084efc8742a4221d5f.tar.gz
remove remaining vestiges of teaspoon test runner
Diffstat (limited to 'lib/tasks/karma.rake')
-rw-r--r--lib/tasks/karma.rake25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/tasks/karma.rake b/lib/tasks/karma.rake
new file mode 100644
index 00000000000..89812a179ec
--- /dev/null
+++ b/lib/tasks/karma.rake
@@ -0,0 +1,25 @@
+unless Rails.env.production?
+ Rake::Task['karma'].clear if Rake::Task.task_defined?('karma')
+
+ namespace :karma do
+ desc 'GitLab | Karma | Generate fixtures for JavaScript tests'
+ RSpec::Core::RakeTask.new(:fixtures) do |t|
+ ENV['NO_KNAPSACK'] = 'true'
+ t.pattern = 'spec/javascripts/fixtures/*.rb'
+ t.rspec_opts = '--format documentation'
+ end
+
+ desc 'GitLab | Karma | Run JavaScript tests'
+ task :tests do
+ sh "npm 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 do
+ Rake::Task['karma:fixtures'].invoke
+ Rake::Task['karma:tests'].invoke
+ end
+end