"How to force run unit tests when running Git push?" Code Answer's
You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "How to force run unit tests when running Git push?" answered properly. Developers are finding an appropriate answer about How to force run unit tests when running Git push? related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like How to force run unit tests when running Git push?. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on How to force run unit tests when running Git push?.
How to force run unit tests when running Git push?
#!/bin/bash
while read oldrev newrev refname
do
# Only run this script for the master branch. You can remove this
# if block if you wish to run it for others as well.
if [[ $refname = "refs/heads/master" ]] ; then
# Anything echo'd will show up in the console for the person
# who's doing a push
echo "Preparing to run phpunit for $newrev ... "
# Since the repo is bare, we need to put the actual files someplace,
# so we use the temp dir we chose earlier
git archive $newrev | tar -x -C /home/jani/tmp/example
echo "Running phpunit for $newrev ... "
# This part is the actual code which is used to run our tests
# In my case, the phpunit testsuite resides in the tests directory, so go there
cd /home/jani/tmp/example/tests
# And execute the testsuite, while ignoring any output
phpunit > /dev/null
# $? is a shell variable which stores the return code from what we just ran
rc=$?
if [[ $rc != 0 ]] ; then
# A non-zero return code means an error occurred, so tell the user and exit
echo "phpunit failed on rev $newrev - push deniend. Run tests locally and confirm they pass before pushing"
exit $rc
fi
fi
done
# Everything went OK so we can exit with a zero
exit 0
Source: codeutopia.net
All those coders who are working on the TypeScript based application and are stuck on How to force run unit tests when running Git push? can get a collection of related answers to their query. Programmers need to enter their query on How to force run unit tests when running Git push? related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about How to force run unit tests when running Git push? for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of How to force run unit tests when running Git push? while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "How to force run unit tests when running Git push?". Visit this developer's friendly online web community, CodeProZone, and get your queries like How to force run unit tests when running Git push? resolved professionally and stay updated to the latest TypeScript updates.