docs/concepts/assertions/api/called-with-new.md
assert.calledWithNew(spyOrSpyCall);Passes, when the fake, spy or stub was called with the new operator.
It's possible to assert on a dedicated spyCall: sinon.assert.calledWithNew(call);.
import * as sinon from "sinon";
const fake = sinon.fake();
sinon.assert.calledWithNew(fake);
// => Uncaught Error [AssertError]: expected fake to be called with new
fake();
sinon.assert.calledWithNew(fake);
// => Uncaught Error [AssertError]: expected fake to be called with new
new fake();
// Generates no error
sinon.assert.calledWithNew(fake);
spyCallimport * as sinon from "sinon";
const fake = sinon.fake();
new fake();
// get a spyCall instance
const call = fake.firstCall;
// Generates no error
sinon.assert.calledWithNew(call);
<<< ../../../.vitepress/tests/docs/assertions/api/called-with-new.test.js