Env variables (eg RUST_BACKTRACE=1) seem ignored in Cargo Test launch configuration
mickaelistria opened this issue · 0 comments
mickaelistria commented
I have a project with a test like
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
#[test]
fn it_fails() {
use std::{thread, time};
thread::sleep(time::Duration::from_secs(10));
assert_eq!(2 + 2, 5);
}
}
and get as response in the output
---- tests::it_fails stdout ----
thread 'tests::it_fails' panicked at 'assertion failed: `(left == right)`
left: `4`,
right: `5`', tests/test.rs:12:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Then I did go to the launch configuration and did set RUST_BACKTRACE to 1, but nothing changes, message is still here so it seems like the Environment Variables are ignored.
Setting this RUST_BACKTRACE in CLI with RUST_BACKTRACE=1 cargo test
works as expected.