Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Track return values in spy calls #474

Merged
merged 2 commits into from Sep 22, 2014

Conversation

Projects
None yet
3 participants
Contributor

pimterry commented Dec 8, 2013

When you're spying on functions which return things, it's occasionally extremely useful to be able to see what those calls returned, particularly with callThrough and callFake. This patch adds return value tracking so you can do that.

I have made the actual implementation (base.js) for this slightly more complicated than it might need to be to keep current behaviour, where you can examine spy.calls and see the current call while you're currently executing it (in a callFake, for example), as the track() call happens before the spyStrategy.exec call. Very happy to simplify that if you're happy to change that behaviour though!

I'd update the docs for this too, but I can't see them anywhere...

Contributor

sheelc commented Dec 13, 2013

For reference, Jasmine 2.0 docs live in a separate repo.

Also, so that they're linked, this pull request would address concerns in issue #164. There's some discussion there as to the utility of this feature (which is why we haven't merged it in already).

@slackersoft slackersoft merged commit b1d4ab0 into jasmine:master Sep 22, 2014

1 check passed

default The Travis CI build passed
Details

@pimterry pimterry deleted the pimterry:trackReturnValues branch Sep 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment