File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 44
55- ` [jest-core] ` Add support for ` testResultsProcessor ` written in ESM ([ #12006 ] ( https://github.com/facebook/jest/pull/12006 ) )
66- ` [jest-diff, pretty-format] ` Add ` compareKeys ` option for custom sorting of object keys ([ #11992 ] ( https://github.com/facebook/jest/pull/11992 ) )
7- - ` [jest-mock] ` Add ` ts-jest ` mock util functions ([ #12089 ] ( https://github.com/facebook/jest/pull/12089 ) )
7+ - ` [jest-mock] ` Add ` ts-jest ` mock util functions ([ #12089 ] ( https://github.com/facebook/jest/pull/12089 ) )
88
99### Fixes
1010
Original file line number Diff line number Diff line change @@ -597,32 +597,31 @@ export const foo = {
597597 },
598598 },
599599 name : () => ' foo' ,
600- }
600+ };
601601```
602602
603603``` ts
604604// foo.spec.ts
605- import { foo } from ' ./foo'
606- jest .mock (' ./foo' )
605+ import {foo } from ' ./foo' ;
606+ jest .mock (' ./foo' );
607607
608608// here the whole foo var is mocked deeply
609- const mockedFoo = jest .mocked (foo , true )
609+ const mockedFoo = jest .mocked (foo , true );
610610
611611test (' deep' , () => {
612612 // there will be no TS error here, and you'll have completion in modern IDEs
613- mockedFoo .a .b .c .hello (' me' )
613+ mockedFoo .a .b .c .hello (' me' );
614614 // same here
615- expect (mockedFoo .a .b .c .hello .mock .calls ).toHaveLength (1 )
616- })
615+ expect (mockedFoo .a .b .c .hello .mock .calls ).toHaveLength (1 );
616+ });
617617
618618test (' direct' , () => {
619- foo .name ()
619+ foo .name ();
620620 // here only foo.name is mocked (or its methods if it's an object)
621- expect (mocked (foo .name ).mock .calls ).toHaveLength (1 )
622- })
621+ expect (mocked (foo .name ).mock .calls ).toHaveLength (1 );
622+ });
623623```
624624
625-
626625## Mock Timers
627626
628627### ` jest.useFakeTimers(implementation?: 'modern' | 'legacy') `
You can’t perform that action at this time.
0 commit comments