From c16974b091bd289c44f93c851062dbb4bdd7ada2 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Mon, 14 Aug 2023 18:31:50 -0700 Subject: [PATCH] Improved jsdocs for originalFn argument to createSpy Fixes jasmine.github.io#137. --- lib/jasmine-core/jasmine.js | 6 +++++- src/core/requireInterface.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 9dfae028..68e875df 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -8479,7 +8479,11 @@ getJasmineRequireObj().interface = function(jasmine, env) { * @since 1.3.0 * @function * @param {String} [name] - Name to give the spy. This will be displayed in failure messages. - * @param {Function} [originalFn] - Function to act as the real implementation. + * @param {Function} [originalFn] - The "real" function. This will + * be used for subsequent calls to the spy after you call + * `mySpy.and.callThrough()`. In most cases you should omit this parameter. + * The usual way to supply an original function is to call {@link spyOn} + * instead of createSpy. * @return {Spy} */ jasmine.createSpy = function(name, originalFn) { diff --git a/src/core/requireInterface.js b/src/core/requireInterface.js index 43265a13..c3d5de1e 100644 --- a/src/core/requireInterface.js +++ b/src/core/requireInterface.js @@ -423,7 +423,11 @@ getJasmineRequireObj().interface = function(jasmine, env) { * @since 1.3.0 * @function * @param {String} [name] - Name to give the spy. This will be displayed in failure messages. - * @param {Function} [originalFn] - Function to act as the real implementation. + * @param {Function} [originalFn] - The "real" function. This will + * be used for subsequent calls to the spy after you call + * `mySpy.and.callThrough()`. In most cases you should omit this parameter. + * The usual way to supply an original function is to call {@link spyOn} + * instead of createSpy. * @return {Spy} */ jasmine.createSpy = function(name, originalFn) {