From 123df37c5ddeef39f1f15c1c1f58354489e44294 Mon Sep 17 00:00:00 2001 From: Daniel Kaplan Date: Thu, 4 Jan 2024 21:13:33 -0800 Subject: [PATCH] Add createStubInstance header in stubs.md I kept scrolling past the parts of this page that explain `createStubInstance` so I created a section for it. I think the reason it didn't already exist is because it's considered a part of the utilities API, not the stub API. Even if that's the reasoning, I hope this PR is still a net positive, because personally, it makes it easier to find what I'm looking for. --- docs/release-source/release/stubs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-source/release/stubs.md b/docs/release-source/release/stubs.md index 8bc556f68..59eef699b 100644 --- a/docs/release-source/release/stubs.md +++ b/docs/release-source/release/stubs.md @@ -90,6 +90,8 @@ Note that it's usually better practice to stub individual methods, particularly Stubbing individual methods tests intent more precisely and is less susceptible to unexpected behavior as the object's code evolves. +#### `var stubInstance = sinon.createStubInstance(MyConstructor, overrides);` + If you want to create a stub object of `MyConstructor`, but don't want the constructor to be invoked, use this utility function. ```javascript