aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorIgor Minar2012-08-30 01:10:28 -0700
committerIgor Minar2012-09-13 16:23:18 -0700
commit9d168f058f9c6d7eeae0daa7cb72ea4e02a0003a (patch)
tree0addcfc0a1d59f54c646ff2c7dd68fd01428cedf /Rakefile
parent5418564f0462a7f9b9458b170271a9a267dc4f79 (diff)
downloadangular.js-9d168f058f9c6d7eeae0daa7cb72ea4e02a0003a.tar.bz2
chore(testing): Testacular config files + rake tasks
- adds testacular config files for jqlite, jquery, modules and e2e tests - replaces obsolete JsTD Rake tasks with Testacular onces - rake tasks are parameterazied so that they can be used locally as well as on CI server usage: rake test # run all tests on Chrome rake test[Safari+Chrome+Opera] # run all tests on Safari, Chrome and Opera rake test[Safari] # run all tests on Safari rake test:jqlite # run unit tests using jqlite on Chrome rake test:jqlite[Safari,"--reporter=dots"] # run jqlite-based unit tests on Safari with dots reporter rake autotest:jquery # start testacular with jquery-based config and watch fs for changes rake test:e2e # run end to end tests
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile65
1 files changed, 55 insertions, 10 deletions
diff --git a/Rakefile b/Rakefile
index 887548b8..3bd3d1b0 100644
--- a/Rakefile
+++ b/Rakefile
@@ -170,24 +170,60 @@ task :package => [:clean, :minify, :version, :docs] do
end
-namespace :server do
+desc 'Run all AngularJS tests'
+task :test, :browsers, :misc_options do |t, args|
- desc 'Run JsTestDriver Server'
- task :start do
- sh %x(java -jar lib/jstestdriver/JsTestDriver.jar --browser open --port 9876)
+ puts args
+
+ [ 'test:jqlite',
+ 'test:jquery',
+ 'test:modules',
+ 'test:e2e'
+ ].each do |task|
+ Rake::Task[task].invoke(args[:browsers], args[:misc_options])
+ end
+end
+
+
+namespace :test do
+
+ desc 'Run jqLite-based unit test suite (single run)'
+ task :jqlite, :browsers, :misc_options do |t, args|
+ start_testacular('testacular-jqlite.conf.js', true, args[:browsers], args[:misc_options])
end
- desc 'Run JavaScript tests against the server'
- task :test do
- sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all)
+
+ desc 'Run jQuery-based unit test suite (single run)'
+ task :jquery, :browsers do |t, args|
+ start_testacular('testacular-jquery.conf.js', true, args[:browsers], args[:misc_options])
+ end
+
+
+ desc 'Run bundled modules unit test suite (single run)'
+ task :modules, :browsers, :misc_options do |t, args|
+ start_testacular('testacular-modules.conf.js', true, args[:browsers], args[:misc_options])
end
+
+ desc 'Run e2e test suite (single run)'
+ task :e2e, :browsers, :misc_options do |t, args|
+ start_testacular('testacular-e2e.conf.js', true, args[:browsers], args[:misc_options])
+ end
end
-desc 'Run JavaScript tests'
-task :test do
- sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all --browser open --port 9876)
+namespace :autotest do
+
+ desc 'Run jqLite-based unit test suite (autowatch)'
+ task :jqlite, :browsers, :misc_options do |t, args|
+ start_testacular('testacular-jqlite.conf.js', false, args[:browsers], args[:misc_options])
+ end
+
+
+ desc 'Run jQuery-based unit test suite (autowatch)'
+ task :jquery, :browsers, :misc_options do |t, args|
+ start_testacular('testacular-jquery.conf.js', false, args[:browsers], args[:misc_options])
+ end
end
@@ -302,3 +338,12 @@ def rewrite_file(filename)
f.write content
end
end
+
+
+def start_testacular(config, singleRun, browsers, misc_options)
+ sh "testacular start " +
+ "#{config} " +
+ "#{'--single-run=true' if singleRun} " +
+ "#{'--browsers=' + browsers.gsub('+', ',') if browsers} " +
+ "#{misc_options}"
+end