From 2edb0c24b1607bb98b624a5c2e6ce907e86bd911 Mon Sep 17 00:00:00 2001 From: greasycat <131315c@gmail.com> Date: Mon, 23 Mar 2026 21:25:42 -0400 Subject: [PATCH] test(search): skip fzf integration tests on GitHub Actions --- tests/search_fzf.rs | 16 ++++++++++++++++ tests/search_only_cli.rs | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/search_fzf.rs b/tests/search_fzf.rs index 97c8aca..fab6caa 100644 --- a/tests/search_fzf.rs +++ b/tests/search_fzf.rs @@ -1,8 +1,16 @@ use std::fs; use wkey::model::{Item, Note, Shortcut}; +fn should_skip_on_github_actions() -> bool { + std::env::var_os("GITHUB_ACTIONS").is_some() +} + #[test] fn search_items_returns_selected_item_key_from_fzf_output() { + if should_skip_on_github_actions() { + return; + } + let temp = tempfile::tempdir().unwrap(); let fake_fzf = temp.path().join("fake-fzf"); fs::write( @@ -30,6 +38,10 @@ fn search_items_returns_selected_item_key_from_fzf_output() { #[test] fn search_items_invokes_fzf_with_top_aligned_layout() { + if should_skip_on_github_actions() { + return; + } + let temp = tempfile::tempdir().unwrap(); let fake_fzf = temp.path().join("fake-fzf"); let args_file = temp.path().join("args.txt"); @@ -63,6 +75,10 @@ fn search_items_invokes_fzf_with_top_aligned_layout() { #[test] fn search_items_with_fallback_does_not_invoke_fallback_on_cancel() { + if should_skip_on_github_actions() { + return; + } + let temp = tempfile::tempdir().unwrap(); let fake_fzf = temp.path().join("fake-fzf"); fs::write(&fake_fzf, "#!/bin/sh\nexit 130\n").unwrap(); diff --git a/tests/search_only_cli.rs b/tests/search_only_cli.rs index 33e0107..b78fbda 100644 --- a/tests/search_only_cli.rs +++ b/tests/search_only_cli.rs @@ -7,8 +7,16 @@ fn shell_quote(value: &str) -> String { format!("'{}'", value.replace('\'', "'\\''")) } +fn should_skip_on_github_actions() -> bool { + std::env::var_os("GITHUB_ACTIONS").is_some() +} + #[test] fn search_only_prints_selected_item_desc_without_opening_main_tui() { + if should_skip_on_github_actions() { + return; + } + let temp = tempfile::tempdir().unwrap(); let config_dir = temp.path().join("config"); let fake_bin_dir = temp.path().join("bin"); @@ -61,6 +69,10 @@ tip = { desc = "Remember this" } #[test] fn search_only_also_pipes_selected_desc_to_pipeout_command() { + if should_skip_on_github_actions() { + return; + } + let temp = tempfile::tempdir().unwrap(); let config_dir = temp.path().join("config"); let fake_bin_dir = temp.path().join("bin");