You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a module that handles Express error logging and I have an endpoint where I intentionally throw an error. I do this because I want the error to pass through the error handling Express middleware and log it with a specific winston transport. However I would like to suppress the error so it's stack is not printed when I run my tests with mocha. Any way to do this?
The text was updated successfully, but these errors were encountered:
Hi @teckays I'd disable console output in the winston transport, perhaps by directing the output to a different stream of your choice so you can still add some assertions. If the stacktrace is being logged by a different function, then again, I'd either disable/redirect it, or just overwrite console.log/process.stdout.write for that spec.
There's a pretty long issue on the topic here that includes an example: #1582 (comment)
I'm building a module that handles Express error logging and I have an endpoint where I intentionally throw an error. I do this because I want the error to pass through the error handling Express middleware and log it with a specific
winston
transport. However I would like to suppress the error so it's stack is not printed when I run my tests with mocha. Any way to do this?The text was updated successfully, but these errors were encountered: