From d0db5b16750e1ffe64a639ad8a14d3bec0d494aa Mon Sep 17 00:00:00 2001 From: zjp Date: Sun, 27 Oct 2024 20:05:54 +0800 Subject: [PATCH] testcases: skip zero testcase --- src/repo/testcases.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/repo/testcases.rs b/src/repo/testcases.rs index b4f8098..837a67a 100644 --- a/src/repo/testcases.rs +++ b/src/repo/testcases.rs @@ -15,10 +15,20 @@ pub type PkgTests = IndexMap; // nextest reports all member tests even if it's run under a member, so we just run under workspace pub fn get(repo_root: &Utf8Path, workspace_root: &Utf8Path) -> Result { let summary = test_list(workspace_root)?; + let workspace_tests_count = summary.test_count; + // nextest will report all bins even if zero testcase, so don't show them + if workspace_tests_count == 0 { + return Ok(Default::default()); + } let mut map = PkgTests::with_capacity(summary.rust_suites.len()); for ele in summary.rust_suites.values() { + if ele.test_cases.is_empty() { + // skip zero testcase + continue; + } + let test = TestBinary::new(ele, repo_root); if let Some((_, _, tests)) = map.get_full_mut(&ele.package_name) { tests.tests.push(test);