--- /dev/null
+// Karma configuration
+// http://karma-runner.github.io/0.12/config/configuration-file.html
+// Generated on 2015-08-16 using
+// generator-karma 1.0.0
+
+module.exports = function(config) {
+ 'use strict';
+
+ config.set({
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: true,
+
+ // base path, that will be used to resolve files and exclude
+ basePath: '',
+
+ // testing framework to use (jasmine/mocha/qunit/...)
+ // as well as any additional frameworks (requirejs/chai/sinon/...)
+ frameworks: [
+ 'jasmine'
+ ],
+
+ // list of files / patterns to load in the browser
+ files: [
+ //bower:js
+ 'bower_components/angular/angular.js',
+ 'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
+ 'bower_components/angular-translate/angular-translate.js',
+ 'bower_components/angular-ui-router/release/angular-ui-router.js',
+ 'bower_components/oclazyload/dist/ocLazyLoad.min.js',
+ 'bower_components/jquery/dist/jquery.js',
+ 'bower_components/bootstrap/dist/js/bootstrap.js',
+ 'bower_components/angular-mocks/angular-mocks.js',
+ //endbower
+ 'src/showcase/app/**/*.module.js',
+ 'src/showcase/app/**/*.js'
+ ],
+
+ // list of files / patterns to exclude
+ exclude: [
+ ],
+
+ // web server port
+ port: 8080,
+
+ // Start these browsers, currently available:
+ // - Chrome
+ // - ChromeCanary
+ // - Firefox
+ // - Opera
+ // - Safari (only Mac)
+ // - PhantomJS
+ // - IE (only Windows)
+ browsers: [
+ 'PhantomJS'
+ ],
+
+ // Which plugins to enable
+ plugins: [
+ 'karma-phantomjs-launcher',
+ 'karma-jasmine',
+ 'karma-coverage',
+ 'karma-junit-reporter'
+ ],
+
+ // command line argument override the configuration from the config file
+ reporters: ['progress', 'junit', 'coverage'],
+
+ junitReporter: {
+ // results will be saved as $outputDir/$browserName.xml
+ outputDir: 'report',
+ // if included, results will be saved as $outputDir/$browserName/$outputFile
+ outputFile: 'test-results.xml'
+ // suite will become the package name attribute in xml testsuite element
+ // suite: ''
+ },
+
+ preprocessors: {
+ 'src/showcase/app/**/!(*.spec)+(.js)': ['coverage']
+ },
+
+ coverageReporter: {
+ // specify a common output directory
+ dir: 'report/coverage',
+ reporters: [
+ // reporters not supporting the `file` property
+ {type: 'html', subdir: 'report-html'},
+ {type: 'lcov', subdir: 'report-lcov'},
+ // reporters supporting the `file` property, use `subdir` to directly
+ // output them in the `dir` directory
+ {type: 'cobertura', subdir: '.', file: 'cobertura.txt'},
+ {type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt'},
+ {type: 'teamcity', subdir: '.', file: 'teamcity.txt'},
+ {type: 'text', subdir: '.', file: 'text.txt'},
+ {type: 'text-summary'}
+ ]
+ },
+
+ // Continuous Integration mode
+ // if true, it capture browsers, run tests and exit
+ singleRun: false,
+
+ colors: true,
+
+ // level of logging
+ // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
+ logLevel: config.LOG_INFO
+
+ // Uncomment the following lines if you are using grunt's server to run the tests
+ // proxies: {
+ // '/': 'http://localhost:9000/'
+ // },
+ // URL root prevent conflicts with the site root
+ // urlRoot: '_karma_'
+ });
+};
+++ /dev/null
-// Karma configuration
-// http://karma-runner.github.io/0.12/config/configuration-file.html
-// Generated on 2015-08-16 using
-// generator-karma 1.0.0
-
-module.exports = function(config) {
- 'use strict';
-
- config.set({
- // enable / disable watching file and executing tests whenever any file changes
- autoWatch: true,
-
- // base path, that will be used to resolve files and exclude
- basePath: '',
-
- // testing framework to use (jasmine/mocha/qunit/...)
- // as well as any additional frameworks (requirejs/chai/sinon/...)
- frameworks: [
- 'jasmine'
- ],
-
- // list of files / patterns to load in the browser
- files: [
- //bower:js
- //endbower
- ],
-
- // list of files / patterns to exclude
- exclude: [
- ],
-
- // web server port
- port: 8080,
-
- // Start these browsers, currently available:
- // - Chrome
- // - ChromeCanary
- // - Firefox
- // - Opera
- // - Safari (only Mac)
- // - PhantomJS
- // - IE (only Windows)
- browsers: [
- 'PhantomJS'
- ],
-
- // Which plugins to enable
- plugins: [
- 'karma-phantomjs-launcher',
- 'karma-jasmine',
- 'karma-coverage',
- 'karma-junit-reporter'
- ],
-
- // command line argument override the configuration from the config file
- reporters: ['progress', 'junit', 'coverage'],
-
- junitReporter: {
- // results will be saved as $outputDir/$browserName.xml
- outputDir: process.cwd() + '/report',
- // if included, results will be saved as $outputDir/$browserName/$outputFile
- outputFile: 'test-results.xml'
- // suite will become the package name attribute in xml testsuite element
- // suite: ''
- },
-
-
- preprocessors: {
- '/home/gustavo/github/JavaScriptForFun/angularjs/showcase/src/showcase/app/**/!(*.spec)+(.js)': ['coverage']
- },
-
- coverageReporter: {
- // specify a common output directory
- dir: process.cwd() + '/report/coverage',
- reporters: [
- // reporters not supporting the `file` property
- {type: 'html', subdir: 'report-html'},
- {type: 'lcov', subdir: 'report-lcov'},
- // reporters supporting the `file` property, use `subdir` to directly
- // output them in the `dir` directory
- {type: 'cobertura', subdir: '.', file: 'cobertura.txt'},
- {type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt'},
- {type: 'teamcity', subdir: '.', file: 'teamcity.txt'},
- {type: 'text', subdir: '.', file: 'text.txt'},
- {type: 'text-summary'}
- ]
- },
-
- // Continuous Integration mode
- // if true, it capture browsers, run tests and exit
- singleRun: false,
-
- colors: true,
-
- // level of logging
- // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
- logLevel: config.LOG_INFO
-
- // Uncomment the following lines if you are using grunt's server to run the tests
- // proxies: {
- // '/': 'http://localhost:9000/'
- // },
- // URL root prevent conflicts with the site root
- // urlRoot: '_karma_'
- });
-};
* @ngdoc function
*
* @description
+ * wire up bower dependencies into karma.conf.js
+ *
+ * @returns {Stream}
+ */
+ gulp.task('wireupkarma', function() {
+
+ log('*** Wiring bower dependencies into karma.conf.js ***');
+
+ var wiredep = require('wiredep').stream;
+
+ return gulp.src(config.karmaConf)
+ .pipe(wiredep(config.wiredepKarmaOptions))
+ .pipe(gulp.dest(currentDir));
+ });
+
+ /**
+ * @ngdoc function
+ *
+ * @description
* Runs HTTP server.
*/
gulp.task('server', function(done) {
*
* @returns {Stream}
*/
- gulp.task('test', ['vet'], function(done) {
+ gulp.task('test', ['vet', 'wireupkarma'], function(done) {
log('*** Run tests once ***');
* @description
* Run specs and wait. Watch for file changes and re-run tests on each change
*/
- gulp.task('autotest', function(done) {
+ gulp.task('autotest', ['wireupkarma'], function(done) {
log('*** Run tests and wait ***');
* @returns {undefined}
*/
function startTests(singleRun, done) {
- var wiredep = require('wiredep');
- var bowerFiles = wiredep(config.wiredepKarmaOptions)['js'];
var excludeFiles = [];
var Server = require('karma').Server;
var karma = new Server({
- files: [].concat(
- bowerFiles,
- process.cwd() + '/src/showcase/app/**/*.module.js',
- process.cwd() + '/src/showcase/app/**/*.js'
- ),
- configFile: __dirname + '/karma.conf.js',
+ configFile: currentDir + '/karma.conf.js',
exclude: excludeFiles,
singleRun: singleRun
}, doneKarma);