refactor(test_utils): use json to run collection and add run time edit (#3807)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Pa1NarK
2024-03-04 13:11:12 +05:30
committed by GitHub
parent 5bb67c7dcc
commit a1d63d4b8b
39 changed files with 231 additions and 369 deletions

View File

@ -16,28 +16,20 @@ fn main() {
};
let status = child.wait();
if runner.file_modified_flag {
let git_status = Command::new("git")
.args([
"restore",
format!("{}/event.prerequest.js", runner.collection_path).as_str(),
])
.output();
// Filter out None values leaving behind Some(Path)
let paths: Vec<String> = runner.modified_file_paths.into_iter().flatten().collect();
let git_status = Command::new("git").arg("restore").args(&paths).output();
match git_status {
Ok(output) => {
if output.status.success() {
let stdout_str = String::from_utf8_lossy(&output.stdout);
println!("Git command executed successfully: {stdout_str}");
} else {
let stderr_str = String::from_utf8_lossy(&output.stderr);
eprintln!("Git command failed with error: {stderr_str}");
}
}
Err(e) => {
eprintln!("Error running Git: {e}");
match git_status {
Ok(output) => {
if !output.status.success() {
let stderr_str = String::from_utf8_lossy(&output.stderr);
eprintln!("Git command failed with error: {stderr_str}");
}
}
Err(e) => {
eprintln!("Error running Git: {e}");
}
}
let exit_code = match status {