From 36deb567c8aa02a3d27582d5023d2b9f31cee50b Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 24 Jul 2023 03:05:09 -0400 Subject: [PATCH] fix(tests): sort categories alphabetically --- cli/src/test.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/src/test.rs b/cli/src/test.rs index 69c4a663..c531c18a 100644 --- a/cli/src/test.rs +++ b/cli/src/test.rs @@ -353,9 +353,18 @@ pub fn parse_tests(path: &Path) -> io::Result { let entry = entry?; let hidden = entry.file_name().to_str().unwrap_or("").starts_with("."); if !hidden { - children.push(parse_tests(&entry.path())?); + children.push(entry.path()); } } + children.sort_by(|a, b| { + a.file_name() + .unwrap_or_default() + .cmp(&b.file_name().unwrap_or_default()) + }); + let children = children + .iter() + .map(|path| parse_tests(path)) + .collect::>>()?; Ok(TestEntry::Group { name, children,