Skip to content

Commit 0e3b5ad

Browse files
committed
testutils: enable backtrace capture by default (RUST_LIB_BACKTRACE=1) in tests
So backtraces are shown without requiring the environment variable.
1 parent 36c45c2 commit 0e3b5ad

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/testutils/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ pub mod test_backend;
8787
fn init_color_eyre() {
8888
use color_eyre::config::HookBuilder;
8989

90+
// Enable backtrace capture by default in tests
91+
if std::env::var("RUST_BACKTRACE").is_err() {
92+
unsafe {
93+
std::env::set_var("RUST_BACKTRACE", "1");
94+
}
95+
}
96+
9097
drop(
9198
HookBuilder::default()
9299
.capture_span_trace_by_default(false)

0 commit comments

Comments
 (0)