mirror of
https://github.com/zplug/zplug
synced 2026-03-07 06:31:48 +01:00
CI runners (GitHub Actions) may have piped stdin, causing [[ -p /dev/stdin ]] to return true and triggering the deprecated pipe-syntax warning on every zplug call in tests.
27 lines
649 B
Bash
27 lines
649 B
Bash
# test/helper.zsh — Common test setup for command-level tests
|
|
#
|
|
# Source this file at the top of each .t file:
|
|
# source "$ZPLUG_ROOT/test/helper.zsh"
|
|
|
|
# Isolated ZPLUG_HOME per test file
|
|
export ZPLUG_HOME="$(mktemp -d)"
|
|
export ZPLUG_REPOS="$ZPLUG_HOME/repos"
|
|
export ZPLUG_BIN="$ZPLUG_HOME/bin"
|
|
export ZPLUG_LOADFILE="$ZPLUG_HOME/packages.zsh"
|
|
export ZPLUG_USE_CACHE=false
|
|
|
|
# Ensure stdin is not a pipe (CI runners may have piped stdin,
|
|
# which triggers zplug's deprecated pipe-syntax detection)
|
|
exec < /dev/null
|
|
|
|
# Initialize zplug
|
|
source "$ZPLUG_ROOT/init.zsh"
|
|
|
|
# Reset state
|
|
zplugs=()
|
|
|
|
cleanup() {
|
|
rm -rf "$ZPLUG_HOME"
|
|
}
|
|
trap cleanup EXIT
|