skovhus / jest-codemods

Codemods for migrating to Jest https://github.com/facebook/jest 👾
MIT License
878 stars 81 forks source link

support jasmine spyOnProperty #603

Closed jase88 closed 2 weeks ago

jase88 commented 3 weeks ago

jasmine can spy on properties , see their docs.

Desired behaviour

Input:

spyOnProperty(component, 'propertyName1').and.returnValue(42);
spyOnProperty(component, 'propertyName2', 'get').and.returnValue(true);

should be transformed to:

jest.spyOn(component, 'propertyName1', 'get').mockReturnValue(42);
jest.spyOn(component, 'propertyName2', 'get').mockReturnValue(true);