From 496c4b784513495840ed9894dc2a599df3a5218f Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Tue, 24 Sep 2024 16:42:50 +0800 Subject: [PATCH] fix no sunch file or dir when mauanlly gen test driver (#340) --- crates/moon/src/cli/generate_test_driver.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/moon/src/cli/generate_test_driver.rs b/crates/moon/src/cli/generate_test_driver.rs index 54111bbd..fcf89ae1 100644 --- a/crates/moon/src/cli/generate_test_driver.rs +++ b/crates/moon/src/cli/generate_test_driver.rs @@ -68,6 +68,11 @@ fn moonc_gen_test_info(files: &[PathBuf], output_path: &Path) -> anyhow::Result< .with_context(|| gen_error_message(files))?; generated.wait()?; + // when mauanlly execute command to generate test driver, we need to create the parent directory + if !output_path.parent().unwrap().exists() { + std::fs::create_dir_all(output_path.parent().unwrap())?; + } + let test_info_json_path = output_path; std::fs::OpenOptions::new() .create(true)