Search code examples
javascriptjqueryrequirejsjasmineblanket.js

How to make requirejs to work with jasmine and blanketjs for code coverage?


I was working on generating code coverage report using blanketjs. Click here .

But I am finding difficulty in achieving the same.

Here's my code : require(['jquery', 'boot', 'JasmineBlanket'], function ($, boot, blanket) { blanket.options('filter', 'js/'); // exclude filter blanket.options('antifilter', [ 'js/third-party', '../test/spec/', 'js/text.js' ]); blanket.options('branchTracking', true); var jasmineEnv = jasmine.getEnv(); jasmineEnv.addReporter(new jasmine.BlanketReporter()); jasmineEnv.updateInterval = 1000; // Define all of your specs here. These are RequireJS modules. var specs = [ 'operatorscreentests/CanvasToolsTests', 'operatorscreentests/SmoothingTests', 'operatorscreentests/UIToolsTests' ]; $(document).ready(function() { require(specs, function(spec) { window.onload(); }); });

I am getting undefined for blanket


Solution

  • Remove these things from above code to make it work : Code : blanket.options('filter', 'js/'); // exclude filter blanket.options('antifilter', [ 'js/third-party', '../test/spec/', 'js/text.js' ]); blanket.options('branchTracking', true);

    Remove above things and you are ready to go. Basically in HtmlReporter you have already added the reporter as blanket by using jasmineEnv.addReporter(new jasmine.BlanketReporter()); which is enough.

    Let me know if it works.