Skip to content

Commit

Permalink
style: indent
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Feb 13, 2024
1 parent cd4d65a commit 1c9fe32
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions test/functions.sh
Expand Up @@ -2,55 +2,55 @@
set -eu

setup() {
name="$(basename -- "$0")"
testDir="/tmp/husky-test-$name"
echo
echo "-------------------"
echo "+ $name"
echo "-------------------"
echo
# Create test directory
rm -rf "$testDir"
mkdir -p "$testDir"
cd "$testDir"
# Init git
git init --quiet
git config user.email "test@test"
git config user.name "test"
# Init package.json
npm_config_loglevel="error" npm init -y 1>/dev/null
name="$(basename -- "$0")"
testDir="/tmp/husky-test-$name"
echo
echo "-------------------"
echo "+ $name"
echo "-------------------"
echo
# Create test directory
rm -rf "$testDir"
mkdir -p "$testDir"
cd "$testDir"
# Init git
git init --quiet
git config user.email "test@test"
git config user.name "test"
# Init package.json
npm_config_loglevel="error" npm init -y 1>/dev/null
}
install() {
npm install ../husky.tgz
npm install ../husky.tgz
}
expect() {
set +e
sh -c "$2"
exitCode="$?"
set -e
if [ $exitCode != "$1" ]; then
error "expect command \"$2\" to exit with code $1 (got $exitCode)"
fi
set +e
sh -c "$2"
exitCode="$?"
set -e
if [ $exitCode != "$1" ]; then
error "expect command \"$2\" to exit with code $1 (got $exitCode)"
fi
}

expect_hooksPath_to_be() {
set +e
hooksPath=$(git config core.hooksPath)
if [ "$hooksPath" != "$1" ]; then
error "core.hooksPath should be $1, was $hooksPath"
fi
hooksPath=$(git config core.hooksPath)
if [ "$hooksPath" != "$1" ]; then
error "core.hooksPath should be $1, was $hooksPath"
fi
}

error() {
echo -e "\e[0;31mERROR:\e[m $1"
exit 1
echo -e "\e[0;31mERROR:\e[m $1"
exit 1
}

ok() {
echo -e "\e[0;32mOK\e[m"
echo -e "\e[0;32mOK\e[m"
}

0 comments on commit 1c9fe32

Please sign in to comment.