You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
version 0.5.1 introduced a regression that was a result of #752
Mocked implementation that returns bullish values stopped working.
The following test illustrates the issue:
import{createMock}from'@golevelup/ts-jest';describe(`test`,()=>{it('mock called with another mock',async()=>{interfaceTest{foo(): number|undefined;}constmock=createMock<Test>();mock.foo.mockImplementation(()=>{return6;});expect(mock.foo()).toEqual(6);mock.foo.mockImplementation(()=>{return7;});expect(mock.foo()).toEqual(7);mock.foo.mockImplementation(()=>{return0;});expect(mock.foo()).toEqual(0);// Failsmock.foo.mockImplementation(()=>{returnundefined;});expect(mock.foo()).toEqual(undefined);//Fails});});
Error: Unexpected return from a matcher function.
Matcher functions should return an object in the following format:
{message?: string | function, pass: boolean}
'{"actual": [Function mockConstructor], "expected": 0, "message": [Function anonymous], "name": "toEqual", "pass": [Function mockConstructor]}' was returned
The text was updated successfully, but these errors were encountered:
version 0.5.1 introduced a regression that was a result of #752
Mocked implementation that returns bullish values stopped working.
The following test illustrates the issue:
The text was updated successfully, but these errors were encountered: