Last active
August 29, 2015 14:17
-
-
Save Swiip/2dbfd47a8fdf95cf23f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(config) { | |
config.set({ | |
logLevel: config.LOG_INFO, | |
frameworks: ['jasmine'], | |
browsers : ['PhantomJS'], | |
ngHtml2JsPreprocessor: { | |
stripPrefix: 'src/', | |
moduleName: 'gulpAngular' | |
}, | |
plugins : [ | |
'karma-phantomjs-launcher', | |
'karma-jasmine', | |
'karma-ng-html2js-preprocessor' | |
], | |
preprocessors: { | |
'src/**/*.html': ['ng-html2js'] | |
} | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
var wiredep = require('wiredep'); | |
var karma = require('karma'); | |
var concat = require('concat-stream'); | |
var _ = require('lodash'); | |
module.exports = function(options) { | |
function listFiles(callback) { | |
var bowerDeps = wiredep({ | |
directory: 'bower_components', | |
exclude: ['bootstrap-sass-official'], | |
dependencies: true, | |
devDependencies: true | |
}); | |
var specFiles = [ | |
options.src + '/**/*.spec.js', | |
options.src + '/**/*.mock.js' | |
]; | |
var htmlFiles = [ | |
options.src + '/**/*.html' | |
]; | |
var srcFiles = [ | |
options.src + '/{app,components}/**/*.js', | |
].concat(specFiles.map(function(file) { | |
return '!' + file; | |
})); | |
gulp.src(srcFiles) | |
.pipe($.angularFilesort()) | |
.pipe(concat(function(files) { | |
callback(bowerDeps.js | |
.concat(_.pluck(files, 'path')) | |
.concat(htmlFiles) | |
.concat(specFiles)); | |
})); | |
} | |
function runTests (singleRun, done) { | |
listFiles(function(files) { | |
karma.server.start({ | |
configFile: __dirname + '/../karma.conf.js', | |
files: files, | |
singleRun: singleRun | |
}, done); | |
}); | |
} | |
gulp.task('test', ['scripts'], function(done) { | |
runTests(true, done); | |
}); | |
gulp.task('test:auto', ['watch'], function(done) { | |
runTests(false, done); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment