karma-sinon-ie

Sinon for Karma (including IE compatiblity files)

14 个版本
安装
npm install karma-sinon-ie
yarn add karma-sinon-ie
pnpm add karma-sinon-ie
bun add karma-sinon-ie
README

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();
    });

});
版本列表
2.0.0 2016-11-04
2.0.0-rc9 2016-02-22
2.0.0-rc8 2016-02-22
2.0.0-rc7 2016-02-22
2.0.0-rc6 2016-01-13
2.0.0-rc5 2016-01-13
2.0.0-rc4 2016-01-12
2.0.0-rc3 2016-01-12
2.0.0-rc2 2016-01-12
2.0.0-rc10 2016-03-21
2.0.0-rc1 2016-01-12
1.0.2 2015-02-25
1.0.1 2014-08-04
1.0.0 2014-08-04