Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(cli): return current defaults for fresh project configs
Akshar Patel98de43ccb806
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 9b172fa48..9f3141c11 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -313,6 +313,7 @@ jobs:cargo test --locked -p cap --bin cap record::testscargo test --locked -p cap --bin cap recordings::testscargo test --locked -p cap --test cli recordings_list+ cargo test --locked -p cap --test cli project_config_get_without_file_returns_defaultcargo test --locked -p cap-recording --lib -- --test-threads=1cargo test --locked -p cap-recording --test x11_shm_capture -- --test-threads=1cargo test --locked -p scap-targets --lib --test linux_targetsdiff --git a/apps/cli/src/project.rs b/apps/cli/src/project.rsindex 8fbf00526..1c5bdd6a2 100644--- a/apps/cli/src/project.rs+++ b/apps/cli/src/project.rs@@ -30,8 +30,7 @@ pub fn config_get(project_path: PathBuf) -> Result<(), String> {Ok(config) => config,// Instant and un-edited studio recordings have no project-config.json; return the// effective default the editor/exporter would use rather than erroring.- Err(e) if e.kind() == std::io::ErrorKind::NotFound => serde_json::from_str("{}")- .map_err(|e| format!("Failed to build default project config: {e}"))?,+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => Default::default(),Err(e) => return Err(format!("Failed to load project config: {e}")),};crate::write_json(&config)diff --git a/apps/cli/tests/cli.rs b/apps/cli/tests/cli.rsindex d3372bb3e..a855f6c10 100644--- a/apps/cli/tests/cli.rs+++ b/apps/cli/tests/cli.rs@@ -702,7 +702,9 @@ fn project_config_get_without_file_returns_default() {]);assert!(output.status.success(), "stderr: {}", stderr(&output));let json = parse_json(&output);- assert!(json.is_object(), "expected a default project config object");+ let expected_json =+ serde_json::to_string(&cap_project::ProjectConfiguration::default()).unwrap();+ assert_eq!(json, serde_json::from_str::<Value>(&expected_json).unwrap());}#[test]