From 91fa865bf22afdf4b25a20acce7a8c7f7d331323 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 20 Mar 2013 18:57:13 -0700 Subject: chore: use Karma --- Gruntfile.js | 12 ++++++------ angularFiles.js | 2 +- karma-e2e.conf.js | 20 ++++++++++++++++++++ karma-jqlite.conf.js | 14 ++++++++++++++ karma-jquery.conf.js | 14 ++++++++++++++ karma-modules.conf.js | 14 ++++++++++++++ lib/grunt/plugins.js | 8 ++++---- lib/grunt/utils.js | 4 ++-- package.json | 2 +- testacular-e2e.conf.js | 20 -------------------- testacular-jqlite.conf.js | 14 -------------- testacular-jquery.conf.js | 14 -------------- testacular-modules.conf.js | 14 -------------- 13 files changed, 76 insertions(+), 76 deletions(-) create mode 100644 karma-e2e.conf.js create mode 100644 karma-jqlite.conf.js create mode 100644 karma-jquery.conf.js create mode 100644 karma-modules.conf.js delete mode 100644 testacular-e2e.conf.js delete mode 100644 testacular-jqlite.conf.js delete mode 100644 testacular-jquery.conf.js delete mode 100644 testacular-modules.conf.js diff --git a/Gruntfile.js b/Gruntfile.js index eea8b8ab..2cbfcda3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -45,17 +45,17 @@ module.exports = function(grunt) { test: { - jqlite: 'testacular-jqlite.conf.js', - jquery: 'testacular-jquery.conf.js', - modules: 'testacular-modules.conf.js', + jqlite: 'karma-jqlite.conf.js', + jquery: 'karma-jquery.conf.js', + modules: 'karma-modules.conf.js', //NOTE run grunt test:e2e instead and it will start a webserver for you - end2end: 'testacular-e2e.conf.js' + end2end: 'karma-e2e.conf.js' }, autotest: { - jqlite: 'testacular-jqlite.conf.js', - jquery: 'testacular-jquery.conf.js' + jqlite: 'karma-jqlite.conf.js', + jquery: 'karma-jquery.conf.js' }, diff --git a/angularFiles.js b/angularFiles.js index 47f18961..20d94360 100644 --- a/angularFiles.js +++ b/angularFiles.js @@ -201,7 +201,7 @@ if (exports) { var files = []; [].splice.call(arguments, 0).forEach(function(file) { - if (file.match(/testacular/)) { + if (file.match(/karma/)) { files.push(file); } else { angularFiles[file].forEach(function(f) { diff --git a/karma-e2e.conf.js b/karma-e2e.conf.js new file mode 100644 index 00000000..07c79c70 --- /dev/null +++ b/karma-e2e.conf.js @@ -0,0 +1,20 @@ +var angularFiles = require(__dirname + '/angularFiles.js'); + +files = [ANGULAR_SCENARIO, ANGULAR_SCENARIO_ADAPTER, 'build/docs/docs-scenario.js']; + +autoWatch = false; +singleRun = true; +logLevel = LOG_INFO; +logColors = true; +browsers = ['Chrome']; + +proxies = { + // angular.js, angular-resource.js, etc + '/angular': 'http://localhost:8000/build/angular', + '/': 'http://localhost:8000/build/docs/' +}; + +junitReporter = { + outputFile: 'test_out/e2e.xml', + suite: 'E2E' +}; diff --git a/karma-jqlite.conf.js b/karma-jqlite.conf.js new file mode 100644 index 00000000..6cb98114 --- /dev/null +++ b/karma-jqlite.conf.js @@ -0,0 +1,14 @@ +var angularFiles = require(__dirname + '/angularFiles.js'); + +files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstd'); +exclude = ['**/*jasmine*/**', '**/*jstd*/**'].concat(angularFiles.files.jstdExclude); + +autoWatch = true; +logLevel = LOG_INFO; +logColors = true; +browsers = ['Chrome']; + +junitReporter = { + outputFile: 'test_out/jqlite.xml', + suite: 'jqLite' +}; diff --git a/karma-jquery.conf.js b/karma-jquery.conf.js new file mode 100644 index 00000000..7b527a15 --- /dev/null +++ b/karma-jquery.conf.js @@ -0,0 +1,14 @@ +var angularFiles = require(__dirname + '/angularFiles.js'); + +files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstdJquery'); +exclude = ['**/*jasmine*/**', '**/*jstd*/**'].concat(angularFiles.files.jstdJqueryExclude); + +autoWatch = true; +logLevel = LOG_INFO; +logColors = true; +browsers = ['Chrome']; + +junitReporter = { + outputFile: 'test_out/jquery.xml', + suite: 'jQuery' +}; diff --git a/karma-modules.conf.js b/karma-modules.conf.js new file mode 100644 index 00000000..9fea7d58 --- /dev/null +++ b/karma-modules.conf.js @@ -0,0 +1,14 @@ +var angularFiles = require(__dirname + '/angularFiles.js'); + +files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstdModules', 'angularSrcModules'); +exclude = ['**/*jasmine*/**', '**/*jstd*/**']; + +autoWatch = true; +logLevel = LOG_INFO; +logColors = true; +browsers = ['Chrome']; + +junitReporter = { + outputFile: 'test_out/modules.xml', + suite: 'modules' +}; diff --git a/lib/grunt/plugins.js b/lib/grunt/plugins.js index c67aa545..b423b61f 100644 --- a/lib/grunt/plugins.js +++ b/lib/grunt/plugins.js @@ -50,12 +50,12 @@ module.exports = function(grunt) { }); - grunt.registerMultiTask('test', 'Run the unit tests with testacular', function(){ - util.startTestacular.call(util, this.data, true, this.async()); + grunt.registerMultiTask('test', 'Run the unit tests with Karma', function(){ + util.startKarma.call(util, this.data, true, this.async()); }); - grunt.registerMultiTask('autotest', 'Run and watch the unit tests with testacular', function(){ - util.startTestacular.call(util, this.data, false, this.async()); + grunt.registerMultiTask('autotest', 'Run and watch the unit tests with Karma', function(){ + util.startKarma.call(util, this.data, false, this.async()); }); }; diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js index 80a41f30..abc71816 100644 --- a/lib/grunt/utils.js +++ b/lib/grunt/utils.js @@ -30,11 +30,11 @@ module.exports = { }, - startTestacular: function(config, singleRun, done){ + startKarma: function(config, singleRun, done){ var browsers = grunt.option('browsers'); var reporters = grunt.option('reporters'); var noColor = grunt.option('no-colors'); - var p = spawn('node', ['node_modules/testacular/bin/testacular', 'start', config, + var p = spawn('node', ['node_modules/karma/bin/karma', 'start', config, singleRun ? '--single-run=true' : '', reporters ? '--reporters=' + reporters : '', browsers ? '--browsers=' + browsers : '', diff --git a/package.json b/package.json index 2398c921..37fa8cbd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "AngularJS", "version": "0.0.0", "dependencies": { - "testacular": "0.5.9", "jasmine-node": "1.2.3", "q-fs": "0.1.36", "qq": "0.3.5", @@ -12,6 +11,7 @@ "grunt-contrib-connect": "0.1.2", "grunt-contrib-compress": "0.4.1", "shelljs": "0.1.2", + "karma": "~0.8", "yaml-js": "0.0.5" } } diff --git a/testacular-e2e.conf.js b/testacular-e2e.conf.js deleted file mode 100644 index 07c79c70..00000000 --- a/testacular-e2e.conf.js +++ /dev/null @@ -1,20 +0,0 @@ -var angularFiles = require(__dirname + '/angularFiles.js'); - -files = [ANGULAR_SCENARIO, ANGULAR_SCENARIO_ADAPTER, 'build/docs/docs-scenario.js']; - -autoWatch = false; -singleRun = true; -logLevel = LOG_INFO; -logColors = true; -browsers = ['Chrome']; - -proxies = { - // angular.js, angular-resource.js, etc - '/angular': 'http://localhost:8000/build/angular', - '/': 'http://localhost:8000/build/docs/' -}; - -junitReporter = { - outputFile: 'test_out/e2e.xml', - suite: 'E2E' -}; diff --git a/testacular-jqlite.conf.js b/testacular-jqlite.conf.js deleted file mode 100644 index 6cb98114..00000000 --- a/testacular-jqlite.conf.js +++ /dev/null @@ -1,14 +0,0 @@ -var angularFiles = require(__dirname + '/angularFiles.js'); - -files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstd'); -exclude = ['**/*jasmine*/**', '**/*jstd*/**'].concat(angularFiles.files.jstdExclude); - -autoWatch = true; -logLevel = LOG_INFO; -logColors = true; -browsers = ['Chrome']; - -junitReporter = { - outputFile: 'test_out/jqlite.xml', - suite: 'jqLite' -}; diff --git a/testacular-jquery.conf.js b/testacular-jquery.conf.js deleted file mode 100644 index 7b527a15..00000000 --- a/testacular-jquery.conf.js +++ /dev/null @@ -1,14 +0,0 @@ -var angularFiles = require(__dirname + '/angularFiles.js'); - -files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstdJquery'); -exclude = ['**/*jasmine*/**', '**/*jstd*/**'].concat(angularFiles.files.jstdJqueryExclude); - -autoWatch = true; -logLevel = LOG_INFO; -logColors = true; -browsers = ['Chrome']; - -junitReporter = { - outputFile: 'test_out/jquery.xml', - suite: 'jQuery' -}; diff --git a/testacular-modules.conf.js b/testacular-modules.conf.js deleted file mode 100644 index 9fea7d58..00000000 --- a/testacular-modules.conf.js +++ /dev/null @@ -1,14 +0,0 @@ -var angularFiles = require(__dirname + '/angularFiles.js'); - -files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstdModules', 'angularSrcModules'); -exclude = ['**/*jasmine*/**', '**/*jstd*/**']; - -autoWatch = true; -logLevel = LOG_INFO; -logColors = true; -browsers = ['Chrome']; - -junitReporter = { - outputFile: 'test_out/modules.xml', - suite: 'modules' -}; -- cgit v1.2.3