Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add throwsArg(index) to mocks #1270

Closed
pimterry opened this issue Feb 17, 2017 · 3 comments
Closed

Add throwsArg(index) to mocks #1270

pimterry opened this issue Feb 17, 2017 · 3 comments

Comments

@pimterry
Copy link
Contributor

Sinon supports returnsArg(index) to easily pass on a value that was passed in, and callsArg(index) to callback to an arg that was passed in, but not throwsArg(index) to rethrow an error argument that was passed in. This is useful for functions which rethrow a provided error, e.g. when mocking error handlers and hooks.

Would you accept a PR for this?

@mroderick
Copy link
Member

That seems like a reasonable expansion of the API

seppevs added a commit to seppevs/sinon that referenced this issue Mar 8, 2017
This was requested through sinonjs#1270
mantoni pushed a commit that referenced this issue May 20, 2017
* add throwsArg(index) to stubs

This was requested through #1270

* added additional tests

* reviewer comments

* added spy.throwArg to mirror stub.throwsArg
@stale
Copy link

stale bot commented Jan 13, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 13, 2018
@pimterry
Copy link
Contributor Author

It looks like this was added in 2.3.0, so this can indeed be closed (though that means the wontfix label isn't super accurate).

@mroderick mroderick removed the stale label Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants