diff --git a/.config/nextest.toml b/.config/nextest.toml index 9f515aa..0f76185 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -5,6 +5,6 @@ uv = { max-threads = 1} # due to concurrent uv cache writes. # Configure these tests to run sequentially. [[profile.default.overrides]] -filter = 'test(run_basic) | test(local_need_install)' +filter = 'binary(run) and test(/run_basic|local_need_install/)' platform = 'cfg(windows)' test-group = 'uv' diff --git a/tests/common/mod.rs b/tests/common/mod.rs index b9cac21..6cd9d5f 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -184,25 +184,27 @@ impl TestContext { .current_dir(&self.temp_dir) .assert() .success(); + } + /// Configure git user and email. + pub fn configure_git_author(&self) { Command::new("git") .arg("config") - .current_dir(&self.temp_dir) .arg("user.name") - .arg("Test User") + .arg("Pre-Commit Test") + .current_dir(&self.temp_dir) .assert() .success(); - Command::new("git") .arg("config") - .current_dir(&self.temp_dir) .arg("user.email") - .arg("test@example.com") + .arg("test@pre-commit-rs.dev") + .current_dir(&self.temp_dir) .assert() .success(); } - /// Run `git add` in the temporary directory. + /// Run `git add`. pub fn git_add(&self, path: impl AsRef) { Command::new("git") .arg("add") @@ -212,7 +214,7 @@ impl TestContext { .success(); } - /// Run `git commit` in the temporary directory. + /// Run `git commit`. pub fn git_commit(&self, message: &str) { Command::new("git") .arg("commit") diff --git a/tests/hook_impl.rs b/tests/hook_impl.rs index f4a4596..77f468b 100644 --- a/tests/hook_impl.rs +++ b/tests/hook_impl.rs @@ -25,7 +25,7 @@ fn hook_impl() { "}); context.git_add("."); - + context.configure_git_author(); let mut commit = Command::new("git"); commit .arg("commit") diff --git a/tests/run.rs b/tests/run.rs index 38c2948..1f79a26 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -728,6 +728,7 @@ fn merge_conflicts() -> Result<()> { let cwd = context.workdir(); cwd.child("file.txt").write_str("Hello, world!")?; context.git_add("."); + context.configure_git_author(); context.git_commit("Initial commit"); Command::new("git")