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

Karma and Browserify

And so, we are drawn deeper and deeper into the web of JavaScript frameworks and modules. Our Karma tests still use the regular JavaScript files that now use the require function, which is not found. And so, we need to install another plugin:

npm install watchify --save-devnpm install karma-browserify --save-devnpm install brfs --save-dev

We can now change our Karma configuration(s):

frameworks: ['browserify', 'jasmine', 'mocha', 'chai'],preprocessors: {   '../scripts/*.js': ['browserify', 'coverage'],   'mocha-tests.js': ['browserify']},browserify: {   debug: true,   transform: ['brfs']},

We must add the 'browserify' framework and preprocess some files. The 'scripts/*.js' files use require, so they must be browserified. mocha-tests.js ...

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