karma-sinon-ie

2.0.0 • Public • Published

Karma Sinon with IE patches

Version Downloads

Sinon for Karma with sinon-ie included for IE compatibility.

Use this package instead of karma-sinon only if you require IE support when using fake timers, XMLHttpRequest or XDomainRequest.

Version 2.x

Previously in 1.x this package just loaded sinon-ie.js (see util-ie) from the sinon module -- this worked fine, however newer browsers like Chrome 49+ and Microsoft Edge seem to have issues with the redfined global function hack so I've rewritten the way the hack gets applied to prevent it being applied in environments which don't need it.

Please create an issue if you find any bugs or browsers that don't behave correctly.

Installation

Install the module via npm and remove karma-sinon if you already have it installed.

$ npm install karma-sinon-ie --save-dev

Add sinon to the frameworks key in your Karma configuration:

module.exports = function(config) {
  'use strict';
  config.set({
    #...
    frameworks: ['jasmine', 'sinon'],
    #...
  });
}

Example

describe("sinon example test", function () {
    var time2013_10_01;
 
    time2013_10_01 = (new Date(2013, 10-1, 1)).getTime();
 
    before(function() {
        // sinon was defined in global scope
        this.fakeTimer = new sinon.useFakeTimers(time2013_10_01);
    });
 
    it("some test", function() {
        //test
    });
 
    after(function() {
        this.fakeTimer.restore();
    });
 
});

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i karma-sinon-ie

      Weekly Downloads

      5

      Version

      2.0.0

      License

      none

      Last publish

      Collaborators

      • levibuzolic