From 74cc479a0e1295c9ef673b67edf10c770e019bbc Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Sun, 17 May 2026 09:39:12 +0800 Subject: [PATCH] Insulate vim smoke tests from a user's local chopsticks.vim (#73) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four `vim -u NONE` invocations in scripts/test.sh set a profile or option as their first `-c` then `source .vimrc`. They didn't override XDG_CONFIG_HOME, so .vimrc's local-config hook read ~/.config/chopsticks.vim and any `let g:chopsticks_profile = '...'` there silently overrode the test's setup. After install.sh runs (writing `engineer` or `full` to that file), scripts/test.sh vim fails on the developer's machine but passes in CI — CI never runs install.sh. Fix by prepending XDG_CONFIG_HOME="\$EMPTY_XDG" to the four bare sites, matching what the surrounding tests already do. L176 stays unchanged because it explicitly sets g:chopsticks_local_config to its own controlled file. Closes #72 --- scripts/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 38aa0dc..efa5815 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -165,7 +165,7 @@ check_vim() { XDG_CONFIG_HOME="$EMPTY_XDG" vim -u "$TMP_ROOT/chopsticks path/.vimrc" \ -i NONE -es -N -c 'qa!' 2>&1 - vim -u NONE -i NONE -es -N \ + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \ -c 'let g:chopsticks_profile = "minimal"' \ -c 'source .vimrc' \ -c 'if has_key(g:plugs, "ale") || has_key(g:plugs, "vim-lsp") || has_key(g:plugs, "vim-lsp-settings") || has_key(g:plugs, "asyncomplete.vim") || has_key(g:plugs, "auto-pairs") | cquit | endif' \ @@ -267,7 +267,7 @@ check_vim() { -c 'qa!' 2>&1 grep -Fq 'OK vim-lsp stack (installed; not loaded yet)' "$TMP_ROOT/status-lsp-not-loaded.txt" - vim -u NONE -i NONE -es -N \ + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \ -c 'let g:chopsticks_profile = "minimal"' \ -c 'source .vimrc' \ -c 'ChopsticksStatus' \ @@ -322,7 +322,7 @@ check_vim() { exit 1 fi - vim -u NONE -i NONE -es -N \ + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \ -c 'let g:chopsticks_profile = "minimal"' \ -c 'source .vimrc' \ -c 'normal ,?' \ @@ -347,7 +347,7 @@ check_vim() { -c 'if !&swapfile || !&writebackup || &directory !~# "\.vim/.swap" | cquit | endif' \ -c 'qa!' 2>&1 - vim -u NONE -i NONE -es -N \ + XDG_CONFIG_HOME="$EMPTY_XDG" vim -u NONE -i NONE -es -N \ -c 'let g:ale_fix_on_save = 0' \ -c 'source .vimrc' \ -c 'if g:ale_fix_on_save != 0 | cquit | endif' \