Skip to content

Commit

Permalink
Add createStubInstance header in stubs.md
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DanKaplanSES authored and fatso83 committed Sep 10, 2024
1 parent ad6804c commit 5a7924a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/release-source/release/stubs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a7924a

Please sign in to comment.