FormidableLabs/gulp-karma

Name: gulp-karma

Owner: Formidable

Description: Karma plugin for gulp

Created: 2014-03-12 14:28:07.0

Updated: 2014-05-02 05:19:53.0

Pushed: 2014-03-12 14:31:56.0

Homepage: null

Size: 132

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

gulp-karma NPM version

Karma plugin for gulp 3

Usage

First, install gulp-karma as a development dependency:

install --save-dev gulp-karma

Then, add it to your gulpfile.js:

karma = require('gulp-karma');

testFiles = [
lient/todo.js',
lient/todo.util.js',
lient/todo.App.js',
est/client/*.js'


.task('test', function() {
 Be sure to return the stream
turn gulp.src(testFiles)
.pipe(karma({
  configFile: 'karma.conf.js',
  action: 'run'
}))
.on('error', function(err) {
  // Make sure failed tests cause gulp to exit non-zero
  throw err;
});


.task('default', function() {
lp.src(testFiles)
.pipe(karma({
  configFile: 'karma.conf.js',
  action: 'watch'
}));

API
karma(options)
options.configFile

Type: String

The path to the Karma configuration file.

options.action

Type: String
Default: run

One of the following:

options.*

Any Karma option can be passed as part of the options object. See Karma Configuration for a complete list of options. Note: It's best practice to put options in your Karma config file.

Notes
Task return value

Karma runs asynchronously. When using action: 'run' in a task, you should return the stream so gulp knows the task finished.

Watching

Due to the way Karma works, using gulp.watch to watch files results in contrived usage that doesn't work as expected in some cases. As a result, Karma's watch mechanism is employed to make usage of this plugin as straight forward as possible.

Globs

Globs are resolved before they're sent to Karma, so if you add a new file that matches a glob you passed using gulp.src('test/*').pipe(karma), it won't be caught by Karma.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.