Skip to content

Commit

Permalink
fix: auth-react script
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Nov 22, 2024
1 parent afec02f commit 6ee239e
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .circleci/setupAndTestWithAuthReact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ cd ../../../../supertokens-auth-react/

# SKIP_OAUTH=true npm run test-with-non-node

# Exit script from startEndToEnd func.
trap "exit 1" TERM
export EXIT_PID=$$

function killServers () {
if [[ "${SERVER_STARTED}" != "true" ]]; then
echo "Kill servers."
lsof -i tcp:8082 | grep -m 1 node | awk '{printf $2}' | cut -c 1- | xargs -I {} kill -9 {} > /dev/null 2>&1
lsof -i tcp:3031 | grep -m 1 node | awk '{printf $2}' | cut -c 1- | xargs -I {} kill -9 {} > /dev/null 2>&1
else
echo "Leaving servers running because SERVER_STARTED=true"
fi
}

trap "killServers" EXIT # Trap to execute on script shutdown

# Start by killing any servers up on 8082 and 3031 if any.
killServers

mkdir -p ~/test_report/logs
mkdir -p ~/test_report/react-logs
mkdir -p ~/test_report/screenshots
Expand Down Expand Up @@ -106,6 +125,9 @@ fi
SCREENSHOT_ROOT=~/test_report/screenshots APP_SERVER=$apiPort TEST_MODE=testing npx mocha --bail=$BAIL --require @babel/register --require test/test.mocha.env --timeout 40000 --no-config $SPEC_FILES
testPassed=$?;

echo "testPassed exit code: $testPassed"
killServers

if [[ $testPassed -ne 0 ]]
then
echo "test failed... killing $pid and exiting!"
Expand Down
22 changes: 22 additions & 0 deletions .circleci/setupAndTestWithAuthReactWithDjango.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ cd ../../../../supertokens-auth-react/

# SKIP_OAUTH=true npm run test-with-non-node

# Exit script from startEndToEnd func.
trap "exit 1" TERM
export EXIT_PID=$$

function killServers () {
if [[ "${SERVER_STARTED}" != "true" ]]; then
echo "Kill servers."
lsof -i tcp:8082 | grep -m 1 node | awk '{printf $2}' | cut -c 1- | xargs -I {} kill -9 {} > /dev/null 2>&1
lsof -i tcp:3031 | grep -m 1 node | awk '{printf $2}' | cut -c 1- | xargs -I {} kill -9 {} > /dev/null 2>&1
else
echo "Leaving servers running because SERVER_STARTED=true"
fi
}

trap "killServers" EXIT # Trap to execute on script shutdown

# Start by killing any servers up on 8082 and 3031 if any.
killServers

mkdir -p ~/test_report/logs
mkdir -p ~/test_report/react-logs
mkdir -p ~/test_report/screenshots
Expand Down Expand Up @@ -108,6 +127,9 @@ fi
SCREENSHOT_ROOT=~/test_report/screenshots APP_SERVER=$apiPort TEST_MODE=testing npx mocha --bail=$BAIL --require @babel/register --require test/test.mocha.env --timeout 40000 --no-config $SPEC_FILES
testPassed=$?;

echo "testPassed exit code: $testPassed"
killServers

if [[ $testPassed -ne 0 ]]
then
echo "test failed... killing $pid and exiting!"
Expand Down
22 changes: 22 additions & 0 deletions .circleci/setupAndTestWithAuthReactWithFlask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ cd ../../../../supertokens-auth-react/

# SKIP_OAUTH=true npm run test-with-non-node

# Exit script from startEndToEnd func.
trap "exit 1" TERM
export EXIT_PID=$$

function killServers () {
if [[ "${SERVER_STARTED}" != "true" ]]; then
echo "Kill servers."
lsof -i tcp:8082 | grep -m 1 node | awk '{printf $2}' | cut -c 1- | xargs -I {} kill -9 {} > /dev/null 2>&1
lsof -i tcp:3031 | grep -m 1 node | awk '{printf $2}' | cut -c 1- | xargs -I {} kill -9 {} > /dev/null 2>&1
else
echo "Leaving servers running because SERVER_STARTED=true"
fi
}

trap "killServers" EXIT # Trap to execute on script shutdown

# Start by killing any servers up on 8082 and 3031 if any.
killServers

mkdir -p ~/test_report/logs
mkdir -p ~/test_report/react-logs
mkdir -p ~/test_report/screenshots
Expand Down Expand Up @@ -108,6 +127,9 @@ fi
SCREENSHOT_ROOT=~/test_report/screenshots APP_SERVER=$apiPort TEST_MODE=testing npx mocha --bail=$BAIL --require @babel/register --require test/test.mocha.env --timeout 40000 --no-config $SPEC_FILES
testPassed=$?;

echo "testPassed exit code: $testPassed"
killServers

if [[ $testPassed -ne 0 ]]
then
echo "test failed... killing $pid and exiting!"
Expand Down

0 comments on commit 6ee239e

Please sign in to comment.