Implement throws and mimicks behaviour fix - #80
Conversation
|
I don't have any lint preferences, just don't make it too strict in my opinion. Wow, this is awesome! Only thing missing is documentation and an example in the readme file! Code in libraries is only as good as its documentation. Will merge right away when there's documentation! 👍👍👍 |
|
Actually, at second thought... We should mimick how NSubstitute throws exceptions, since this is a port of that library: https://nsubstitute.github.io/help/throwing-exceptions/ Do you think that is possible in TypeScript? Ironically I think your approach is actually better, but consistency is also quite important. Documentation for throwing exceptions should still be there though. |
Hahaha, I’ll ask only this -> Semicolon yes or no? —- |
|
Semicolon definitely yes 😂 Alright. Mimicks is a substitute.js feature only anyway, so maybe it isn't that bad. Feel free to give it a shot. If we can't do it, we'll merge this anyway. But documentation is needed in either case 👍🙇 |
|
Hahaha that's what I imagined! So, from what I saw, in NSubstitute when using So the options we have is:
On any of the scenarios documentation will be added. I haven't written any, as we didn't decide where to go yet. |
|
Alright, let's go with the original PR then. That's also very easy to understand. |
|
Cool, I will add the documentation for the throws function! |
|
There is the documentation, feel free to modify it or let me know if I should add something more! |
|
Thanks! |
Closes #67
.throwsmethod.mimicksignoring arguments - the mimicks function was always being executed, the arguments that should have been matched were ignoredIt makes me a bit uncomfortable to give
.throwsan argument of type any, but according to the js spec, anything can be thrown.Documentation for.throwsneeds to be addedI would like to refactor (not in this pr) a bit the code, mostly name changes, grouping stuff and cleaner tests. To start to work on that, I really think it would be great to add lint rules, to have all the code of this repository with the same format. Do you have any lint preferences?