Skip to content

Commit 641a5cd

Browse files
committed
Perform additional cleanup when calling callThroughWithNew()
The cleanup for callThroughWithNew() could be the same as for callThrough(). But in the callThroughWithNew() context, we are dealing with constructors, which means the returnThis, resolves, resolvesArg, resolvesthis, rejects, returnsArg and callsFake don't apply. The callsArg/yield stuff still applies and needs to be cleaned-up.
1 parent a0744d5 commit 641a5cd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/sinon/default-behaviors.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,16 @@ const defaultBehaviors = {
265265

266266
callThroughWithNew: function callThroughWithNew(fake) {
267267
fake.callsThroughWithNew = true;
268+
269+
fake.callArgAt = undefined;
270+
fake.exception = undefined;
271+
fake.exceptionCreator = undefined;
272+
fake.throwArgAt = undefined;
273+
274+
fake.callArgProp = undefined;
275+
fake.callbackArguments = [];
276+
fake.callbackContext = undefined;
277+
fake.callbackAsync = false;
268278
},
269279

270280
get: function get(fake, getterFunction) {

0 commit comments

Comments
 (0)