diff --git a/test/install/install.bats b/test/install/install.bats index ded2689a..dc560760 100644 --- a/test/install/install.bats +++ b/test/install/install.bats @@ -14,10 +14,16 @@ case $OSTYPE in esac function local_setup { - mkdir -p $BASH_IT + mkdir -p "$BASH_IT" lib_directory="$(cd "$(dirname "$0")" && pwd)" - cp -r $lib_directory/../../* $BASH_IT/ - rm -rf "$BASH_IT/aliases/enabled" "$BASH_IT/completion/enabled" "$BASH_IT/plugins/enabled" + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled # Don't pollute the user's actual $HOME directory # Use a test home directory instead diff --git a/test/install/uninstall.bats b/test/install/uninstall.bats index adab216f..6c7ae561 100644 --- a/test/install/uninstall.bats +++ b/test/install/uninstall.bats @@ -14,9 +14,16 @@ case $OSTYPE in esac function local_setup { - mkdir -p $BASH_IT + mkdir -p "$BASH_IT" lib_directory="$(cd "$(dirname "$0")" && pwd)" - cp -r $lib_directory/../../* $BASH_IT/ + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled # Don't pollute the user's actual $HOME directory # Use a test home directory instead diff --git a/test/lib/search.bats b/test/lib/search.bats index 71a176d4..28b25d25 100644 --- a/test/lib/search.bats +++ b/test/lib/search.bats @@ -13,9 +13,16 @@ load ../../lib/search NO_COLOR=true function local_setup { - mkdir -p $BASH_IT + mkdir -p "$BASH_IT" lib_directory="$(cd "$(dirname "$0")" && pwd)" - cp -r $lib_directory/../../* $BASH_IT/ + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled } @test "helpers search plugins" {