Add spyOnAllFunctions function

This function will spy on all writable and configurable functionss of
an object that is passed in. It can be used like this:

    spyOnAllFunctions(obj);

This commit addresses https://github.com/jasmine/jasmine/issues/1421
This commit is contained in:
Andrew Eisenberg
2018-07-18 20:04:31 -07:00
parent 110c092c9e
commit f62eb3b1a8
3 changed files with 120 additions and 0 deletions

View File

@@ -235,6 +235,18 @@ getJasmineRequireObj().interface = function(jasmine, env) {
return env.spyOnProperty(obj, methodName, accessType);
},
/**
* Installs spies on all writable and configurable properties of an object.
* @name spyOnProperty
* @function
* @global
* @param {Object} obj - The object upon which to install the {@link Spy}s
* @returns {Object} the spied object
*/
spyOnAllFunctions: function(obj) {
return env.spyOnAllFunctions(obj);
},
jsApiReporter: new jasmine.JsApiReporter({
timer: new jasmine.Timer()
}),