• This repository has been archived on 29/Jul/2022
  • Stars
    star
    310
  • Rank 134,926 (Top 3 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Example of using Karma with Gulp.

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.

More Repositories

1

karma

Spectacular Test Runner for JavaScript
JavaScript
11,952
star
2

karma-coverage

A Karma plugin. Generate code coverage.
JavaScript
768
star
3

karma-jasmine

A Karma plugin - adapter for Jasmine testing framework.
JavaScript
542
star
4

grunt-karma

Grunt plugin for Karma.
JavaScript
468
star
5

karma-chrome-launcher

A Karma plugin. Launcher for Chrome and Chrome Canary.
JavaScript
467
star
6

karma-mocha

A Karma plugin. Adapter for Mocha testing framework.
JavaScript
379
star
7

karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.
JavaScript
281
star
8

karma-ng-html2js-preprocessor

A Karma plugin. Compile AngularJS 1.x and 2.x templates to JavaScript on the fly.
CoffeeScript
266
star
9

karma-sauce-launcher

A Karma plugin. Launch any browser on SauceLabs!
TypeScript
199
star
10

karma-junit-reporter

A Karma plugin. Report results in junit xml format.
JavaScript
176
star
11

karma-browserstack-launcher

A Karma plugin. Launch any browser on BrowserStack!
JavaScript
150
star
12

karma-firefox-launcher

A Karma plugin. Launcher for Firefox.
JavaScript
104
star
13

karma-html2js-preprocessor

A Karma plugin. Convert HTML files into JS strings to serve them in a script tag.
CoffeeScript
74
star
14

karma-commonjs

A Karma plugin. Test CommonJS modules.
JavaScript
73
star
15

karma-webdriver-launcher

A plugin for Karma. Launch any browser with WebDriver.
JavaScript
66
star
16

karma-ie-launcher

A Karma plugin. Launcher for Internet Explorer.
JavaScript
59
star
17

karma-coffee-preprocessor

A Karma plugin. Compile coffee script on the fly.
JavaScript
53
star
18

karma-cli

The Karma command line interface.
JavaScript
52
star
19

karma-qunit

A Karma plugin. Adapter for QUnit testing framework.
JavaScript
51
star
20

maven-karma-plugin

Maven plugin for running tests using Karma.
Java
45
star
21

karma-requirejs

A Karma plugin. Adapter for RequireJS framework.
JavaScript
39
star
22

karma-teamcity-reporter

A Karma plugin. Report results for Teamcity CI.
JavaScript
34
star
23

karma-intellij

Reporter for IntelliJ / WebStorm.
JavaScript
34
star
24

karma-growl-reporter

A Karma plugin. Report results with growl.
JavaScript
27
star
25

karma-ng-scenario

A Karma plugin. Adapter for Angular's Scenario Runner.
JavaScript
25
star
26

karma-runner.github.com

Homepage of Karma - The Spectacular JavaScript Test Runner.
HTML
24
star
27

karma-edge-launcher

A Karma plugin. Launcher for Microsoft Edge.
JavaScript
21
star
28

karma-safari-launcher

A Karma plugin. Launcher for Safari.
JavaScript
19
star
29

karma-closure

A Karma plugin. Resolve Google Closure dependencies on the fly.
JavaScript
18
star
30

karma-dart

DEPRECATED. A plugin for Dart language.
JavaScript
16
star
31

karma-slimerjs-launcher

A Karma launcher for SlimerJS
JavaScript
13
star
32

karma-traceur-preprocessor

A Karma plugin. Compile ES6 script on the fly using traceur-compiler.
JavaScript
13
star
33

karma-nodeunit

A Karma plugin - adapter for Node unit testing framework.
JavaScript
12
star
34

karma-script-launcher

A Karma plugin. Launcher for custom scripts.
JavaScript
9
star
35

integration-tests

JavaScript
8
star
36

karma-dojo

A Karma plugin. Adapter for Dojo Toolkit.
JavaScript
7
star
37

karma-opera-launcher

A Karma plugin. Launcher for Opera.
JavaScript
7
star
38

test-device-manager

Keep-alive test browsers and redirect them to a test server on command.
JavaScript
6
star
39

karma-ember-preprocessor

A Karma plugin. Preprocessor for Ember.js templates (handlebars).
JavaScript
6
star
40

karma-googmodule-preprocessor

A Karma preprocessor to handle Closure's goog.module() system
JavaScript
5
star
41

shared-karma-files

Shared configs for all the Karma repos.
CoffeeScript
2
star