Fix karma-coverage version, use gulp unit to run unit tests

Downgrades karma-coverages, uses phantomJS to run unit test, and
finally adds gulp unit as the test runner. Karma was having issues
with Chrome+Browserify. Unit tests still do not run since the example
services were removed.

Change-Id: I8973a1e12b0b2af992bea5da552aae0736dcdf9c
This commit is contained in:
Austin Clark 2015-10-15 12:47:06 -06:00
parent 865837da38
commit 942f6a9add
3 changed files with 14 additions and 11 deletions

View File

@ -11,8 +11,7 @@ require('./controllers/_index');
require('./services/_index'); require('./services/_index');
require('./directives/_index'); require('./directives/_index');
// create and bootstrap application var bootstrap = function() {
angular.element(document).ready(function() {
var requires = [ var requires = [
'ui.router', 'ui.router',
@ -35,4 +34,9 @@ angular.element(document).ready(function() {
angular.bootstrap(document, ['app']); angular.bootstrap(document, ['app']);
}); window.bootstrap = null;
};
// create and bootstrap application
angular.element(document).ready(bootstrap);
window.bootstrap = bootstrap;

View File

@ -53,9 +53,8 @@
"karma": "~0.12.0", "karma": "~0.12.0",
"karma-babel-preprocessor": "^4.0.1", "karma-babel-preprocessor": "^4.0.1",
"karma-browserify": "^4.0.0", "karma-browserify": "^4.0.0",
"karma-chrome-launcher": "0.1.8",
"karma-cli": "0.0.4", "karma-cli": "0.0.4",
"karma-coverage": "0.3.1", "karma-coverage": "0.2.6",
"karma-jasmine": "^0.3.6", "karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "0.2.0", "karma-phantomjs-launcher": "0.2.0",
"morgan": "^1.6.1", "morgan": "^1.6.1",
@ -71,7 +70,7 @@
}, },
"scripts": { "scripts": {
"postinstall": "if [ ! -d .venv ]; then tox -epy27 --notest; fi", "postinstall": "if [ ! -d .venv ]; then tox -epy27 --notest; fi",
"test": "karma start karma.conf.js --single-run", "test": "gulp unit",
"lint": "eslint --no-color stackviz/static" "lint": "eslint --no-color stackviz/static"
}, },
"dependencies": {} "dependencies": {}

View File

@ -12,10 +12,11 @@ module.exports = function(config) {
preprocessors: { preprocessors: {
'app/js/**/*.js': ['browserify', 'babel', 'coverage'] 'app/js/**/*.js': ['browserify', 'babel', 'coverage']
}, },
browsers: ['Chrome'], browsers: ['PhantomJS'],
reporters: ['progress', 'coverage'], reporters: ['progress', 'coverage'],
autoWatch: true, autoWatch: true,
singleRun: true,
browserify: { browserify: {
debug: true, debug: true,
@ -35,13 +36,12 @@ module.exports = function(config) {
urlRoot: '/__karma__/', urlRoot: '/__karma__/',
files: [ files: [
// 3rd-party resources
'node_modules/angular/angular.min.js',
'node_modules/angular-mocks/angular-mocks.js',
// app-specific code // app-specific code
'app/js/main.js', 'app/js/main.js',
// 3rd-party resources
'node_modules/angular-mocks/angular-mocks.js',
// test files // test files
'test/unit/**/*.js' 'test/unit/**/*.js'
] ]