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
I'm familiar with how to mock simple-git using jest.mock which works fine for single method calls. But if an implementation is using chaining via the Task Promises API, then the mocking becomes much more challenging.
For example the docs show you can do await git.init().addRemote('origin', '...remote.git');
Which under the hood is achieved because each API method (such as init and addRemote) internally invokes this._runTask which looks like the below:
Hi,
I'm familiar with how to mock
simple-git
usingjest.mock
which works fine for single method calls. But if an implementation is using chaining via the Task Promises API, then the mocking becomes much more challenging.For example the docs show you can do
await git.init().addRemote('origin', '...remote.git');
Which under the hood is achieved because each API method (such as
init
andaddRemote
) internally invokesthis._runTask
which looks like the below:Do you have an example of how one might mock
simple-git
to support for the same chaining? e.g.Thanks
The text was updated successfully, but these errors were encountered: