mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
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:
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user