Is it possible to raise a Warning message within a hook function? I can log a message with hook.log() but would like it to be properly handled as loglevel 'warning'.
hooks.log("WARNING: Something unusual has happened")
Is it possible to raise a Warning message within a hook function? I can log a message with hook.log() but would like it to be properly handled as loglevel 'warning'.
hooks.log("WARNING: Something unusual has happened")
I'm the Dredd maintainer. You didn't mention whether you use the standard Node.js hooks or the now deprecated and removed sandboxed JavaScript hooks.
In Node.js hooks there's no way you can hack into Dredd's own logging output, but you could implement it on your own. Dredd's logging uses winston, so you could set it up the same way as in Dredd in your hooks and then log a warning, which is going to look like Dredd's warning.
However, my honest advice would be forget about warnings. Make strict rules and let the testing fail. People overlook warnings in the output, or don't read them at all when the project is tested on CI.