test(tui): serialize completion sound state

The completion sound settings test reads process-global sound state, while another notification test mutates it. Hold the existing module test lock so the default parallel harness cannot race the assertion back to beep mode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hunter B
2026-06-13 12:27:02 -07:00
parent 1574dd488a
commit 1beee1a804
+3 -2
View File
@@ -860,8 +860,8 @@ mod tests {
use super::*;
/// Serialise all tests that mutate `TERM_PROGRAM` to prevent data races
/// when the test harness runs them in parallel threads.
/// Serialise tests that mutate process-global environment or notification
/// sound state while the test harness runs them in parallel threads.
fn env_lock() -> std::sync::MutexGuard<'static, ()> {
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();
LOCK.get_or_init(|| Mutex::new(()))
@@ -1331,6 +1331,7 @@ mod tests {
#[test]
fn settings_installs_custom_completion_sound_file() {
let _lock = env_lock();
let config: crate::config::Config = toml::from_str(
r#"
[notifications]