GeezerVison is showing github.com — chore(testing): Testacular config files + rake tasks · angular/angular.js@9d168f0
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Rakefile +55-10Lines changed: 55 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -170,24 +170,60 @@ task :package => [:clean, :minify, :version, :docs] do | 170 | 170 | end | 171 | 171 |
| 172 | 172 |
| 173 | | -namespace :server do | | 173 | +desc 'Run all AngularJS tests' | | 174 | +task :test, :browsers, :misc_options do |t, args| | 174 | 175 |
| 175 | | - desc 'Run JsTestDriver Server' | 176 | | - task :start do | 177 | | - sh %x(java -jar lib/jstestdriver/JsTestDriver.jar --browser open --port 9876) | | 176 | + puts args | | 177 | + | | 178 | + [ 'test:jqlite', | | 179 | + 'test:jquery', | | 180 | + 'test:modules', | | 181 | + 'test:e2e' | | 182 | + ].each do |task| | | 183 | + Rake::Task[task].invoke(args[:browsers], args[:misc_options]) | | 184 | + end | | 185 | +end | | 186 | + | | 187 | + | | 188 | +namespace :test do | | 189 | + | | 190 | + desc 'Run jqLite-based unit test suite (single run)' | | 191 | + task :jqlite, :browsers, :misc_options do |t, args| | | 192 | + start_testacular('testacular-jqlite.conf.js', true, args[:browsers], args[:misc_options]) | 178 | 193 | end | 179 | 194 |
| 180 | | - desc 'Run JavaScript tests against the server' | 181 | | - task :test do | 182 | | - sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all) | | 195 | + | | 196 | + desc 'Run jQuery-based unit test suite (single run)' | | 197 | + task :jquery, :browsers do |t, args| | | 198 | + start_testacular('testacular-jquery.conf.js', true, args[:browsers], args[:misc_options]) | | 199 | + end | | 200 | + | | 201 | + | | 202 | + desc 'Run bundled modules unit test suite (single run)' | | 203 | + task :modules, :browsers, :misc_options do |t, args| | | 204 | + start_testacular('testacular-modules.conf.js', true, args[:browsers], args[:misc_options]) | 183 | 205 | end | 184 | 206 |
| | 207 | + | | 208 | + desc 'Run e2e test suite (single run)' | | 209 | + task :e2e, :browsers, :misc_options do |t, args| | | 210 | + start_testacular('testacular-e2e.conf.js', true, args[:browsers], args[:misc_options]) | | 211 | + end | 185 | 212 | end | 186 | 213 |
| 187 | 214 |
| 188 | | -desc 'Run JavaScript tests' | 189 | | -task :test do | 190 | | - sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all --browser open --port 9876) | | 215 | +namespace :autotest do | | 216 | + | | 217 | + desc 'Run jqLite-based unit test suite (autowatch)' | | 218 | + task :jqlite, :browsers, :misc_options do |t, args| | | 219 | + start_testacular('testacular-jqlite.conf.js', false, args[:browsers], args[:misc_options]) | | 220 | + end | | 221 | + | | 222 | + | | 223 | + desc 'Run jQuery-based unit test suite (autowatch)' | | 224 | + task :jquery, :browsers, :misc_options do |t, args| | | 225 | + start_testacular('testacular-jquery.conf.js', false, args[:browsers], args[:misc_options]) | | 226 | + end | 191 | 227 | end | 192 | 228 |
| 193 | 229 |
| @@ -302,3 +338,12 @@ def rewrite_file(filename) | 302 | 338 | f.write content | 303 | 339 | end | 304 | 340 | end | | 341 | + | | 342 | + | | 343 | +def start_testacular(config, singleRun, browsers, misc_options) | | 344 | + sh "testacular start " + | | 345 | + "#{config} " + | | 346 | + "#{'--single-run=true' if singleRun} " + | | 347 | + "#{'--browsers=' + browsers.gsub('+', ',') if browsers} " + | | 348 | + "#{misc_options}" | | 349 | +end |
Collapse file Copy file name to clipboardExpand all lines: angularFiles.js +24-30Lines changed: 24 additions & 30 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -196,36 +196,30 @@ angularFiles = { | 196 | 196 | ] | 197 | 197 | }; | 198 | 198 |
| 199 | | -// Execute only in slim-jim | 200 | | -if (typeof JASMINE_ADAPTER !== 'undefined') { | 201 | | - // Testacular config | 202 | | - var mergedFiles = []; | 203 | | - angularFiles.jstd.forEach(function(file) { | 204 | | - // replace @ref | 205 | | - var match = file.match(/^\@(.*)/); | 206 | | - if (match) { | 207 | | - var deps = angularFiles[match[1]]; | 208 | | - if (!deps) { | 209 | | - console.log('No dependency:' + file) | | 199 | +if (exports) { | | 200 | + exports.files = angularFiles | | 201 | + exports.mergeFiles = function mergeFiles() { | | 202 | + var files = []; | | 203 | + | | 204 | + [].splice.call(arguments, 0).forEach(function(file) { | | 205 | + if (file.match(/testacular/)) { | | 206 | + files.push(file); | | 207 | + } else { | | 208 | + angularFiles[file].forEach(function(f) { | | 209 | + // replace @ref | | 210 | + var match = f.match(/^\@(.*)/); | | 211 | + if (match) { | | 212 | + var deps = angularFiles[match[1]]; | | 213 | + files = files.concat(deps); | | 214 | + } else { | | 215 | + if (!/jstd|jasmine/.test(f)) { //TODO(i): remove once we don't have jstd/jasmine in repo | | 216 | + files.push(f); | | 217 | + } | | 218 | + } | | 219 | + }); | 210 | 220 | } | 211 | | - mergedFiles = mergedFiles.concat(deps); | 212 | | - } else { | 213 | | - mergedFiles.push(file); | 214 | | - } | 215 | | - }); | | 221 | + }); | 216 | 222 |
| 217 | | - files = [JASMINE, JASMINE_ADAPTER]; | 218 | | - | 219 | | - mergedFiles.forEach(function(file){ | 220 | | - if (/jstd|jasmine/.test(file)) return; | 221 | | - files.push(file); | 222 | | - }); | 223 | | - | 224 | | - | 225 | | - exclude = angularFiles.jstdExclude; | 226 | | - | 227 | | - autoWatch = true; | 228 | | - autoWatchInterval = 1; | 229 | | - logLevel = LOG_INFO; | 230 | | - logColors = true; | | 223 | + return files; | | 224 | + } | 231 | 225 | } |
Collapse file Copy file name to clipboard +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +var angularFiles = require(__dirname + '/angularFiles.js'); | | 2 | + | | 3 | +files = [ANGULAR_SCENARIO, ANGULAR_SCENARIO_ADAPTER, 'build/docs/docs-scenario.js']; | | 4 | + | | 5 | +autoWatch = false; | | 6 | +singleRun = true; | | 7 | +logLevel = LOG_INFO; | | 8 | +logColors = true; | | 9 | +browsers = ['Chrome'] | | 10 | + | | 11 | +proxies = { | | 12 | + '/': 'http://localhost:8000/build/docs/' | | 13 | +}; |
Collapse file Copy file name to clipboard +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +var angularFiles = require(__dirname + '/angularFiles.js'); | | 2 | + | | 3 | +files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstd'); | | 4 | +exclude = ['**/*jasmine*/**', '**/*jstd*/**'].concat(angularFiles.files.jstdExclude); | | 5 | + | | 6 | +autoWatch = true; | | 7 | +logLevel = LOG_INFO; | | 8 | +logColors = true; | | 9 | +browsers = ['Chrome'] |
Collapse file Copy file name to clipboard +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +var angularFiles = require(__dirname + '/angularFiles.js'); | | 2 | + | | 3 | +files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstdJquery'); | | 4 | +exclude = ['**/*jasmine*/**', '**/*jstd*/**'].concat(angularFiles.files.jstdJqueryExclude); | | 5 | + | | 6 | +autoWatch = true; | | 7 | +logLevel = LOG_INFO; | | 8 | +logColors = true; | | 9 | +browsers = ['Chrome'] |
Collapse file Copy file name to clipboard +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +var angularFiles = require(__dirname + '/angularFiles.js'); | | 2 | + | | 3 | +files = angularFiles.mergeFiles(JASMINE, JASMINE_ADAPTER, 'jstdModules', 'angularSrcModules'); | | 4 | +exclude = ['**/*jasmine*/**', '**/*jstd*/**']; | | 5 | + | | 6 | +autoWatch = true; | | 7 | +logLevel = LOG_INFO; | | 8 | +logColors = true; | | 9 | +browsers = ['Chrome'] |
|