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

Is there a way to catch non-mocked responses? #189

Open
hornta opened this issue Jun 23, 2021 · 3 comments
Open

Is there a way to catch non-mocked responses? #189

hornta opened this issue Jun 23, 2021 · 3 comments
Labels

Comments

@hornta
Copy link

hornta commented Jun 23, 2021

I've setup my test suite to mock every response my application performs to our REST API but I feel like it's common to forget to mock some API:s so I would want a way for our tests to fail when a non-mocked API is called upon. Is something like that possible with nise/sinon?

@fatso83
Copy link
Contributor

fatso83 commented Jun 23, 2021

Not that I can think of immediately, but this is kind of like a catch-all if no other. Would be interesting to have this feature. Can you have a little browse of the (not very big) source code and see if the match code can be made to do this? Maybe it can accept a function or something.

@hornta
Copy link
Author

hornta commented Jun 23, 2021

The fakeserver can take a catch-all response but it doesn't help me being able to throw when that response is matched. I tend to use https://mswjs.io/ in other projects so inspiration can be taken from there https://mswjs.io/docs/recipes/debugging-uncaught-requests

Maybe the fakeserver can emit an event like "onUnhandledRequest"?

Copy link

stale bot commented Dec 27, 2023

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 Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants