Solution
.ONESHELL:
test:
@echo "[ - ] testing app"
@kill -9 $$(lsof -t -i tcp:5000)
@flask run 1>/dev/null 2>/dev/null &
@sleep 2
@cd ../sender
@python main.py > received.txt
@if cmp -s -- received.txt expected.txt; \
then echo "[ > ] PASS 🥳 "; else echo "[ - ] ERROR 😵"; fi
@cd - 1>/dev/null 2>/dev/null