loading...

Jest for Sinon Stubs

penspinner profile image Steven Liao ・1 min read

At work, we recently converted from Mocha, Karma, Chai, and Sinon to Jest. It was not immediately obvious what the direct replacement was for

sinon.stub(object, 'methodName').callsFake(() => {})

Found out Jest provides similar functionality with

jest.spyOn(object, 'methodName').mockImplementation(() => {})

Discussion

markdown guide