Modular extension to run unit tests in a gulp-modular project.
npm install gulp-modular-karma
bower install angular-mocks
Copy default.karma.conf.js
in your project root and name it karma.conf.js
.
var gulp = require('gulp');
var gulpModularKarma = require('gulp-modular-karma');
// optionally overwrite default configuration
var config = {
//// task [`karma`] performs unit tests on project
karma: {
// src : './karma.conf.js', // karma configuration file to use
// browsers: ['PhantomJS', 'Firefox', 'Chrome'] // all browser to run tests in (only for `test:all`)
},
};
gulpModularKarma(gulp, config);
Run gulp karma
to execute the tests once.
Run gulp karma:watch
to execute the tests whenever a file changes.
Run gulp karma:all
to run the tests in all defined browers.
Run gulp test
, gulp test:watch
or gulp test:all
to build the project before the related karma
task is run.