From 55959ca2732376b9a7203b04f845a5f5083e48a1 Mon Sep 17 00:00:00 2001 From: Daniel Heras Quesada Date: Mon, 14 Jul 2025 22:33:37 +0200 Subject: [PATCH] feat: pre-commit now runs front tests --- .githooks/pre-commit | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 8fa7f89..a4f2ec5 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,9 +1,21 @@ #!/bin/sh +# Front cd ./front + +## Tests +echo -e "\e[35m➤ [JEST]\e[0m Testing front project\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" +npm run test +if [[ $? != 0 ]]; then + echo -e "\e[31m➤ [JEST]\e[0m Errors in tests\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" + exit -1; +fi + +## Prettier echo -e "\e[35m➤ [PRETTIER]\e[0m Formatting front files\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" npx prettier . --write --log-level silent +## ESlint echo -e "\e[35m➤ [ESLINT]\e[0m Checking front code\e[37m - \e[33m$(date +"%H:%M:%S")\e[0m" npx lint-staged --silent echo $?