O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running your Karma tests

Next, we want to run our tests. Of course, we already created some tests and ran them with Karma. No worries, we are not going to undo all that. Instead, we are going to run Karma automatically using Gulp. That way, we lint, test, and minify our code with a single gulp command. There used to be a Karma plugin for Gulp, but now it is recommended to just run Karma directly from Gulp. This is actually surprisingly easy:

var gulp = require('gulp');var karma = require('karma').Server;gulp.task('test', function () {   new karma({      configFile: __dirname + '/test/karma.conf.js'   }).start();});

The __dirname variable is a global Node.js variable and contains the current file path. So, we set up a new Karma server from code, pass ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required