Repository: denoland/deno
File: tests/node_compat/mod.rs (Rust)

Code before:
}

#[derive(Debug, Default, Serialize, Clone)]
struct ResultInfo {
  #[serde(rename = "usesNodeTest", skip_serializing_if = "Option::is_none")]
  uses_node_test: Option<u8>,
  #[serde(rename = "ignoreReason", skip_serializing_if = "Option::is_none")]
  ignore_reason: Option<String>,
}

/// Collected test result for report generation
#[derive(Debug, Clone)]
struct CollectedResult {
  passed: Option<bool>, // None means ignored
  error: Option<ErrorInfo>,
  uses_node_test: bool,
  ignore_reason: Option<String>,
}

fn main() {
  let cli_args = parse_cli_args();
  let config = load_config();
  let mut category = if cli_args.report {
    collect_all_tests()
  } else if let Some(filter) = cli_args.filter.as_ref() {
    collect_tests_from_filter(filter.to_string())
  } else {
    collect_tests_from_config(&config)
  };

  // Apply CLI filter if provided
  if let Some(filter) = file_test_runner::collection::parse_cli_arg_filter() {
    category.filter_children(&filter);
  }

  if category.is_empty() {
    return;
  }

  // Partition into sequential and parallel tests
  let (sequential_category, parallel_category) =
    category.partition(|test| test.data.test_path.starts_with("sequential/"));

  let parallelism = Parallelism::default();
  let flaky_test_tracker = Arc::new(FlakyTestTracker::default());

  // Shared state for collecting results
  let results: Arc<Mutex<HashMap<String, CollectedResult>>> =
    Arc::new(Mutex::new(HashMap::new()));

  let reporter = test_util::test_runner::get_test_reporter(

Review comment (suggestion):
I think this should work (it's a bad name. It should just be `filter` instead of `filter_children`):

```suggestion
    collect_all_tests().filter_children(filter)
```

Then we can revert some of the other changes below.

Code after:
}

#[derive(Debug, Default, Serialize, Clone)]
struct ResultInfo {
  #[serde(rename = "usesNodeTest", skip_serializing_if = "Option::is_none")]
  uses_node_test: Option<u8>,
  #[serde(rename = "ignoreReason", skip_serializing_if = "Option::is_none")]
  ignore_reason: Option<String>,
}

/// Collected test result for report generation
#[derive(Debug, Clone)]
struct CollectedResult {
  passed: Option<bool>, // None means ignored
  error: Option<ErrorInfo>,
  uses_node_test: bool,
  ignore_reason: Option<String>,
}

fn main() {
  let cli_args = parse_cli_args();
  let config = load_config();
  let mut category = if cli_args.report {
    collect_all_tests()
  } else if let Some(filter) = cli_args.filter.as_ref() {
    let mut category = collect_all_tests();
    category.filter_children(filter);
    category
  } else {
    collect_tests_from_config(&config)
  };

  // Apply CLI filter if provided
  if let Some(filter) = file_test_runner::collection::parse_cli_arg_filter() {
    category.filter_children(&filter);
  }

  if category.is_empty() {
    return;
  }

  // Partition into sequential and parallel tests
  let (sequential_category, parallel_category) =
    category.partition(|test| test.data.test_path.starts_with("sequential/"));

  let parallelism = Parallelism::default();
  let flaky_test_tracker = Arc::new(FlakyTestTracker::default());

  // Shared state for collecting results
  let results: Arc<Mutex<HashMap<String, CollectedResult>>> =
    Arc::new(Mutex::new(HashMap::new()));