How can I remove a hook from the app on the fly? #3520
-
I have a hook that shows errors generated in the console along with their stack trace, but I want to disable it in some tests. I don’t want to disable it in all tests because it can be useful when debugging, but if I’m testing an endpoint that should fail and I know it will generate an error, I’d like to disable that hook in my app to keep the console clean. What do you suggest I do? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You could make it conditional either by using a request parameter like header or query parameter or if it is only for tests, by using a variable. (https://hooks-common.feathersjs.com/hooks#iff could potentially be useful) |
Beta Was this translation helpful? Give feedback.
You could make it conditional either by using a request parameter like header or query parameter or if it is only for tests, by using a variable.
(https://hooks-common.feathersjs.com/hooks#iff could potentially be useful)