2020-06-23 18:42:54 +02:00
|
|
|
#!/bin/bash
|
2021-02-24 08:32:44 +01:00
|
|
|
set -e
|
2020-06-23 18:42:54 +02:00
|
|
|
|
2020-11-26 15:32:38 +01:00
|
|
|
if ! command -v nodemon &> /dev/null
|
2020-11-18 20:53:01 +01:00
|
|
|
then
|
|
|
|
echo "Please install nodemon (npm install -g nodemon) to automatically run tests."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-05-04 15:41:22 +02:00
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "Are you sure you want to run all backend tests? You can run specific tests by doing:"
|
|
|
|
echo " "
|
|
|
|
echo "bin/tests posthog/api/test/test_user.py::TestUserAPI::test_retrieve_current_user"
|
|
|
|
echo " "
|
|
|
|
read -r -p "Run all tests? [y/N] " response
|
|
|
|
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
|
|
|
then
|
|
|
|
echo "OK!"
|
|
|
|
else
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-02-24 08:32:44 +01:00
|
|
|
export REDIS_URL='redis:///'
|
|
|
|
export TEST=1
|
2021-10-22 15:37:01 +02:00
|
|
|
export DEBUG=1
|
2021-03-01 20:34:39 +01:00
|
|
|
psql posthog -c "drop database if exists test_posthog"
|
|
|
|
nodemon -w ./posthog -w ./ee --ext py --exec "OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES pytest --reuse-db -s $*; mypy posthog ee"
|