Skip to content

Commit 9a3ec0f

Browse files
authored
docs: fix documentation (#14294) (#15649)
1 parent b91c6a0 commit 9a3ec0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/JestObjectAPI.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ If your codebase is set up to transpile the ["explicit resource management"](htt
761761

762762
```js
763763
test('logs a warning', () => {
764-
using spy = jest.spyOn(console.warn);
764+
using spy = jest.spyOn(console, 'warn');
765765
doSomeThingWarnWorthy();
766766
expect(spy).toHaveBeenCalled();
767767
});
@@ -773,7 +773,7 @@ That code is semantically equal to
773773
test('logs a warning', () => {
774774
let spy;
775775
try {
776-
spy = jest.spyOn(console.warn);
776+
spy = jest.spyOn(console, 'warn');
777777
doSomeThingWarnWorthy();
778778
expect(spy).toHaveBeenCalled();
779779
} finally {
@@ -789,7 +789,7 @@ You can even go a step further and use a code block to restrict your mock to onl
789789
```js
790790
test('testing something', () => {
791791
{
792-
using spy = jest.spyOn(console.warn);
792+
using spy = jest.spyOn(console, 'warn');
793793
setupStepThatWillLogAWarning();
794794
}
795795
// here, console.warn is already restored to the original value

0 commit comments

Comments
 (0)