diff --git a/package.json b/package.json index 333fb02d338..4bcf2142694 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "npm": "1.2.x" }, "scripts": { - "test": "grunt" + "test": "grunt test" }, "license": "Apache License" } diff --git a/src/app/services/graphite/lexer.js b/src/app/services/graphite/lexer.js index b4cb8a0e21e..91cd2237bfe 100644 --- a/src/app/services/graphite/lexer.js +++ b/src/app/services/graphite/lexer.js @@ -1,5 +1,6 @@ define([ -], function() { + 'underscore' +], function(_) { 'use strict'; // This is auto generated from the unicode tables. @@ -256,7 +257,7 @@ define([ return (/^[0-9a-fA-F]$/).test(str); } - var readUnicodeEscapeSequence = function () { + var readUnicodeEscapeSequence = _.bind(function () { /*jshint validthis:true */ index += 1; @@ -282,9 +283,9 @@ define([ } return null; - }.bind(this); + }, this); - var getIdentifierStart = function () { + var getIdentifierStart = _.bind(function () { /*jshint validthis:true */ var chr = this.peek(index); var code = chr.charCodeAt(0); @@ -313,9 +314,9 @@ define([ } return null; - }.bind(this); + }, this); - var getIdentifierPart = function () { + var getIdentifierPart = _.bind(function () { /*jshint validthis:true */ var chr = this.peek(index); var code = chr.charCodeAt(0); @@ -339,7 +340,7 @@ define([ } return null; - }.bind(this); + }, this); char = getIdentifierStart(); if (char === null) { diff --git a/tasks/default_task.js b/tasks/default_task.js index c81cf9ba610..8ddd383df0b 100644 --- a/tasks/default_task.js +++ b/tasks/default_task.js @@ -1,4 +1,5 @@ // Lint and build CSS module.exports = function(grunt) { grunt.registerTask('default', ['jshint:source', 'less:src']); + grunt.registerTask('test', ['default', 'karma:test']); }; \ No newline at end of file diff --git a/tasks/options/karma.js b/tasks/options/karma.js index f91c9772267..39f93b5be08 100644 --- a/tasks/options/karma.js +++ b/tasks/options/karma.js @@ -1,9 +1,14 @@ module.exports = function(config) { return { - unit: { + dev: { configFile: 'src/test/karma.conf.js', singleRun: false, browsers: ['Chrome'] + }, + test: { + configFile: 'src/test/karma.conf.js', + singleRun: true, + browsers: ['PhantomJS'] } }; }; \ No newline at end of file