Skip to content

Commit

Permalink
test: add test log
Browse files Browse the repository at this point in the history
  • Loading branch information
oneofthezombies committed Feb 12, 2024
1 parent c8f8ae2 commit 5184bf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/libs/kill_tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tokio = { version = "1.36.0", features = ["full"], optional = true }

[dev-dependencies]
tokio = { version = "1.36.0", features = ["test-util"] }
tracing-test = { version = "0.2.4", features = ["no-env-filter"] }

[target.'cfg(windows)'.dependencies]
windows = { version = "0.52.0", features = [
Expand Down
4 changes: 4 additions & 0 deletions crates/libs/kill_tree/tests/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{process::Command, sync::mpsc, thread, time::Duration};
use tracing_test::traced_test;

fn get_node_script_infinite() -> String {
r"
Expand All @@ -25,6 +26,7 @@ fn get_node_script_spawn_infinite_child() -> String {
.to_string()
}

#[traced_test]
#[test]
fn kill_tree_default() {
let (tx, rx) = mpsc::channel();
Expand All @@ -50,6 +52,7 @@ fn kill_tree_default() {
} => {
assert_eq!(*process_id, target_process_id);
assert_eq!(*parent_process_id, std::process::id());
// There are cases where the process does not start with node, so a log is left for confirmation.
println!("name: {name}");
assert!(name.starts_with("node"));
}
Expand Down Expand Up @@ -99,6 +102,7 @@ fn kill_tree_with_config_sigkill() {
thread.join().unwrap();
}

#[traced_test]
#[test]
fn kill_tree_with_config_include_target_false() {
let (tx, rx) = mpsc::channel();
Expand Down

0 comments on commit 5184bf8

Please sign in to comment.