Spies reflect wrapped function's name & length
This commit is contained in:
parent
f0888ac7bd
commit
6b922d02ea
2 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,11 @@ module.exports = new function init() {
|
|||
|
||||
if (fn) return fn.apply(this, arguments)
|
||||
}
|
||||
if (fn)
|
||||
Object.defineProperties(spy, {
|
||||
length: {value: fn.length},
|
||||
name: {value: fn.name}
|
||||
})
|
||||
spy.args = []
|
||||
spy.callCount = 0
|
||||
return spy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue