Skip to content

stefano-regosa-deel/safe_push

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

unit testing

Setting a local git-hook pre-push which allow to perform a git push only if all tests have been successful !

  1. execute touch .git/hooks/pre-push
  2. write
#!/bin/sh
printf "Starting Unit Tests\n"

npm run test

testResults=$?
if [ $testResults -eq 1 ]
then
    echo -e "\n Tests FAILED\n\n push ABORTED"
    exit 1
fi
exit 0
  1. save the file.
  2. execute chmod +x .git/hooks/pre-push

About

πŸ’ A simple bash script which allow to perform git push only if all tests have been successful !

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages