File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 88
99### Performance
1010
11+ ## 27.0.3
12+
13+ ### Fixes
14+
15+ - ` [jest-mock] ` Fixed ` fn ` and ` spyOn ` exports ([ #11480 ] ( https://github.com/facebook/jest/pull/11480 ) )
16+
1117## 27.0.2
1218
1319### Features
Original file line number Diff line number Diff line change 99/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */
1010
1111import vm , { Context } from 'vm' ;
12- import { ModuleMocker } from '../' ;
12+ import { ModuleMocker , fn , spyOn } from '../' ;
1313
1414describe ( 'moduleMocker' , ( ) => {
1515 let moduleMocker : ModuleMocker ;
@@ -1439,3 +1439,10 @@ describe('moduleMocker', () => {
14391439 } ) ;
14401440 } ) ;
14411441} ) ;
1442+
1443+ test ( '`fn` and `spyOn` do not throw' , ( ) => {
1444+ expect ( ( ) => {
1445+ fn ( ) ;
1446+ spyOn ( { apple : ( ) => { } } , 'apple' ) ;
1447+ } ) . not . toThrow ( ) ;
1448+ } ) ;
Original file line number Diff line number Diff line change @@ -1112,5 +1112,5 @@ export class ModuleMocker {
11121112
11131113const JestMock = new ModuleMocker ( global ) ;
11141114
1115- export const fn = JestMock . fn ;
1116- export const spyOn = JestMock . spyOn ;
1115+ export const fn = JestMock . fn . bind ( JestMock ) ;
1116+ export const spyOn = JestMock . spyOn . bind ( JestMock ) ;
You can’t perform that action at this time.
0 commit comments