Giter Site home page Giter Site logo

gulp-karma's Introduction

devDependency Status

gulp-karma

Karma integration into Gulp.js-based build.

tl;dr;

You don't need any gulp plugins (why?) to run Karma from the Gulp-based build, use Karma directly:

var gulp = require('gulp');
var Server = require('karma').Server;

/**
 * Run test once and exit
 */
gulp.task('test', function (done) {
  new Server({
    configFile: __dirname + '/karma.conf.js',
    singleRun: true
  }, done).start();
});

Illustrated tasks

This sample project illustrates 2 usage scenarios of Karma integration in the Gulp.js build:

  • gulp test - a task that runs all the tests with Karma once and exits. Such a task is often used on CI servers etc.
  • gulp tdd - a task that runs the tests and pauses, watching for file changes. Upon detecting a change Karma re-runs the tests. Such a task is often used during development.

Do we need a plugin?

While there exist integration of the karma-runner into Grunt based builds (https://github.com/karma-runner/grunt-karma) we've decided not to create a dedicated plugin for Gulp.js. The reasoning here is that it is very, very easy to invoke Karma's public API directly from a Gulp.js task, as illustrated in this repository. Writing a dedicated plugin would bring little benefit and could limit possible usage scenarios.

To see how easy is to integrate Karma into an existing Gulp.js build just check the included gulpfile.js.

There are several people moving from Grunt.js to Gulp.js who noticed that with Gulp we often don't need a dedicated plugin anymore. For example, a good overview of such situation can be found in the following article.

gulp-karma's People

Contributors

danielpacak avatar dignifiedquire avatar pkozlowski-opensource avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.