From f4ac5dfe8ce7488e97f5dcc550e6266c4f87d024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jureti=C4=87?= Date: Thu, 31 Oct 2013 22:30:25 -0300 Subject: [PATCH 1/2] fix unit tests --- .travis.yml | 3 ++- karma.conf.js | 4 ++-- package.json | 2 +- test/spec/userServicesSpec.js | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83f4e22f0a..9f977e2505 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: node_js node_js: - - '0.8' - '0.10' before_script: - 'npm install -g bower grunt-cli' - 'bower install' + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start diff --git a/karma.conf.js b/karma.conf.js index 59aff0d276..17f008426c 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -35,7 +35,7 @@ module.exports = function(config) { // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, + autoWatch: true, // Start these browsers, currently available: @@ -46,7 +46,7 @@ module.exports = function(config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers: ['Chrome'], + browsers: ['Firefox'], // Continuous Integration mode diff --git a/package.json b/package.json index 15d13a6fe3..6bedefae7f 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "npm": "1.2.x" }, "scripts": { - "test": "mocha test/api.mocha.coffee", + "test": "grunt karma", "start": "grunt run:dev", "postinstall": "./node_modules/bower/bin/bower install -f" }, diff --git a/test/spec/userServicesSpec.js b/test/spec/userServicesSpec.js index fa2c12a6df..d4e11d8f52 100644 --- a/test/spec/userServicesSpec.js +++ b/test/spec/userServicesSpec.js @@ -7,7 +7,8 @@ describe('userServices', function() { beforeEach(function(){ module(function($provide){ - $window = {href: '', alert: sinon.spy(), location: {search: '', pathname: ''}}; + var habitrpgShared = {helpers: {newUser: sinon.spy()}}; + $window = {href: '', alert: sinon.spy(), location: {search: '', pathname: ''}, habitrpgShared: habitrpgShared}; $provide.value('$window', $window); }); From 142024b8180e89e3d84b4a800d6e4a8e714ca947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jureti=C4=87?= Date: Thu, 31 Oct 2013 22:45:10 -0300 Subject: [PATCH 2/2] define karma task for continuous integration --- Gruntfile.js | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3c1c785ccd..5aef5c132e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,6 +7,11 @@ module.exports = function(grunt) { karma: { unit: { configFile: 'karma.conf.js' + }, + continuous: { + configFile: 'karma.conf.js', + singleRun: true, + autoWatch: false } }, diff --git a/package.json b/package.json index 6bedefae7f..90cc45445c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "npm": "1.2.x" }, "scripts": { - "test": "grunt karma", + "test": "grunt karma:continuous", "start": "grunt run:dev", "postinstall": "./node_modules/bower/bin/bower install -f" },