diff --git a/tests/test-framework/Cargo.toml b/tests/test-framework/Cargo.toml index fa4a97beb6..ff592d09c4 100644 --- a/tests/test-framework/Cargo.toml +++ b/tests/test-framework/Cargo.toml @@ -17,6 +17,9 @@ include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ] license = "GPL-3.0" edition = "2018" +[dependencies] +backtrace = "0.3.65" + [dependencies.serde] version = "1.0" features = [ "derive" ] @@ -64,4 +67,4 @@ path = "../../leo/errors" version = "1.5.3" [dependencies.regex] -version = "1.5" \ No newline at end of file +version = "1.5" diff --git a/tests/test-framework/src/runner.rs b/tests/test-framework/src/runner.rs index a1be3677af..8beb27fbe8 100644 --- a/tests/test-framework/src/runner.rs +++ b/tests/test-framework/src/runner.rs @@ -57,7 +57,14 @@ fn set_hook() -> Arc>> { let panic_buf = panic_buf.clone(); Box::new(move |e| { if thread::current().id() == thread_id { - *panic_buf.lock().unwrap() = Some(e.to_string()); + if !std::env::var("RUST_BACKTRACE") + .unwrap_or_else(|_| "".to_string()) + .is_empty() + { + *panic_buf.lock().unwrap() = Some(format!("{:?}", backtrace::Backtrace::new())); + } else { + *panic_buf.lock().unwrap() = Some(e.to_string()); + } } else { println!("{}", e) }