Fixed Karma client test runner.

This commit is contained in:
Scott Erickson 2014-12-12 11:36:41 -08:00
parent 71ad9248ca
commit e5c5f0ba04
7 changed files with 23 additions and 10 deletions

View file

@ -11,6 +11,7 @@ before_install:
before_script:
- "npm install"
- export DISPLAY=:99.0
- export COCO_TRAVIS_TEST=1
- sh -e /etc/init.d/xvfb start
- "./node_modules/.bin/bower install"
- "gem install sass"

View file

@ -1,7 +1,8 @@
// Helper for running tests through Karma.
// Hooks into the test view logic for running tests.
require('core/initialize');
initialize = require('core/initialize');
initialize.init();
console.debug = function() {}; // Karma conf doesn't seem to work? Debug messages are still emitted when they shouldn't be.
TestView = require('views/TestView');
TestView.runTests();

View file

@ -34,6 +34,8 @@ init = ->
handleNormalUrls()
setUpMoment() # Set up i18n for moment
module.exports.init = init = _.once init
handleNormalUrls = ->
# http://artsy.github.com/blog/2012/06/25/replacing-hashbang-routes-with-pushstate/
$(document).on 'click', "a[href^='/']", (event) ->

View file

@ -21,4 +21,4 @@ ol.breadcrumb
if child.type == 'folder'
strong (#{child.size})
.clearfix
.clearfix

View file

@ -1,5 +1,5 @@
RootView = require 'views/core/RootView'
template = require 'templates/test'
template = require 'templates/test-view'
requireUtils = require 'lib/requireUtils'
require 'vendor/jasmine-bundle'

View file

@ -4,6 +4,7 @@ _.str = require 'underscore.string'
sysPath = require 'path'
fs = require('fs')
commonjsHeader = fs.readFileSync('node_modules/brunch/node_modules/commonjs-require-definition/require.js', {encoding: 'utf8'})
TRAVIS = process.env.COCO_TRAVIS_TEST
#- regJoin replace a single '/' with '[\/\\]' so it can handle either forward or backslash
@ -59,6 +60,9 @@ exports.config =
'app/lib/sprites/SpriteBuilder.coffee' # loaded by ThangType
]
#- Karma is a bit more tricky to get to work. For now just dump everything into one file so it doesn't need to load anything through ModuleLoader.
'javascripts/whole-app.js': if TRAVIS then regJoin('^app') else []
#- Wads. Groups of modules by folder which are loaded as a group when needed.
'javascripts/app/lib.js': regJoin('^app/lib')
'javascripts/app/views/play.js': regJoin('^app/views/play')
@ -80,6 +84,10 @@ exports.config =
regJoin('^bower_components/(?!(aether|d3|treema))')
'bower_components/treema/treema-utils.js'
]
'javascripts/whole-vendor.js': if TRAVIS then [
regJoin('^vendor/scripts/(?!(Box2d|jasmine))')
regJoin('^bower_components/(?!aether)')
] else []
#- Other vendor libraries in separate bunches
@ -103,6 +111,7 @@ exports.config =
'javascripts/app/vendor/diffview.js': 'vendor/scripts/diffview.js'
'javascripts/app/vendor/treema.js': 'bower_components/treema/treema.js'
'javascripts/app/vendor/jasmine-bundle.js': regJoin('^vendor/scripts/jasmine')
'javascripts/app/vendor/jasmine-mock-ajax.js': 'vendor/scripts/jasmine-mock-ajax.js'
#- test, demo libraries
'javascripts/app/tests.js': regJoin('^test/app/')
@ -157,6 +166,7 @@ exports.config =
'javascripts/app/views/play.js': regJoin('^app/templates/play')
'javascripts/app/views/game-menu.js': regJoin('^app/templates/game-menu')
'javascripts/app/views/editor.js': regJoin('^app/templates/editor')
'javascripts/whole-app.js': if TRAVIS then regJoin('^app/templates') else []
framework: 'backbone'
@ -190,6 +200,7 @@ exports.config =
needHeaders = [
'public/javascripts/app.js'
'public/javascripts/world.js'
'public/javascripts/whole-app.js'
]
defn = if path in needHeaders then commonjsHeader else ''
return defn

View file

@ -1,5 +1,3 @@
// Testacular configuration
// Generated on Fri Feb 15 2013 18:38:33 GMT-0500 (EST)
module.exports = function(config) {
@ -11,18 +9,18 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files : [
'public/javascripts/vendor.js',
'public/javascripts/whole-vendor.js',
'public/lib/ace/ace.js',
'public/javascripts/aether.js',
'public/javascripts/app.js',
'public/javascripts/mock-ajax.js',
'public/javascripts/test-app.js',
'public/javascripts/whole-app.js',
'public/javascripts/app/vendor/jasmine-mock-ajax.js',
'public/javascripts/app/tests.js',
'public/javascripts/run-tests.js'
],
preprocessors : {
'**/*.coffee': 'coffee',
'**/javascripts/app.js': 'coverage'
'**/javascripts/whole-app.js': 'coverage'
},
// list of files to exclude