From 04c06b4c5a24686d52014eebf2e1c0cb3d41403b Mon Sep 17 00:00:00 2001 From: duncan Date: Thu, 9 Jan 2025 16:01:08 +0000 Subject: [PATCH] Fix parsing cargo test json output by making stdout and optional field --- crates/rust-analyzer/src/test_runner.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/test_runner.rs b/crates/rust-analyzer/src/test_runner.rs index 503b3ee43a..3edfb812cf 100644 --- a/crates/rust-analyzer/src/test_runner.rs +++ b/crates/rust-analyzer/src/test_runner.rs @@ -18,7 +18,11 @@ pub(crate) enum TestState { Started, Ok, Ignored, - Failed { stdout: String }, + Failed { + // the stdout field is not always present depending on cargo test flags + #[serde(skip_serializing_if = "String::is_empty", default)] + stdout: String, + }, } #[derive(Debug, Deserialize)]