monkeytype/.husky/pre-push
Nad Alaba 5c618082c7
chore(husky): run nvm use only when needed (#5524)
`nvm use` does not work on nvm-windows and there is no need for it to
run everytime anyone pushes to any branch
2024-06-25 10:21:34 +02:00

17 lines
No EOL
475 B
Bash
Executable file

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# Load nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
if [ $(git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') = "master" ] && [ $(git remote get-url origin) = "https://github.com/monkeytypegame/monkeytype" ]; then
nvm use
echo "Running tests before pushing to master..."
npm run test
if [ $? -ne 0 ]; then
echo "Tests failed, aborting push."
exit 1
fi
fi