all files / core/spying/ spy-on.js

100% Statements 11/11
100% Branches 0/0
100% Functions 2/2
100% Lines 11/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  204× 204× 2655× 2655× 2648×   2655×     204× 204×    
"use strict";
var _namespace_1 = require("./_namespace");
function SpyOn(target, functionName) {
    var spy = new _namespace_1.Spy(target[functionName], target);
    target[functionName] = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i - 0] = arguments[_i];
        }
        return spy.call(args);
    };
    // expose spy's calls on function
    target[functionName].calls = spy.calls;
    return spy;
}
exports.SpyOn = SpyOn;
//# sourceMappingURL=spy-on.js.map