Insulate vim smoke tests from a user's local chopsticks.vim (#73)

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
This commit is contained in:
m1ngsama 2026-05-17 09:39:12 +08:00 committed by GitHub
parent debcdd33c4
commit 74cc479a0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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' \