testthat icon indicating copy to clipboard operation
testthat copied to clipboard

Option in `expect()` for turning off backtrace

Open yangsophieee opened this issue 9 months ago • 2 comments

Hi, I saw that a backtrace was added for wrapped expectations (#1307), which is a great addition for debugging. However, I was wondering if it would be useful to add an option for turning the backtrace off. I've tried fiddling with the current trace and trace_env arguments but looking at the code it doesn't seem I'd be able to use them to turn it off.

The reason I'd like to turn them off is I'm using testthat expectations and CompactProgressReporter to summarise problems with data and metadata that is input to a database built by our package. I've created my own expectations which wrap other expectations in order to fully customise the failure messages. I've written them to be accessible to users and so I'd like to turn off the backtrace, since it clutters the progress reporter and would be meaningless to anyone unfamiliar with the package's inner workings.

Thanks very much for the amazing package!

yangsophieee avatar Oct 26 '23 11:10 yangsophieee