Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
feat: new test timeout option (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Shuplenkov authored Sep 4, 2020
1 parent 3045b0e commit c165f65
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Usage: test <seed> [options]
--dpns-tld-identity-private-key=private_key - top level identity private key
--dpns-tld-identity-id=identity_id - top level identity id
--dpns-contract-id=contract_id - dpns contract id
-t --timeout - test timeout in milliseconds
-h --help - show help
Possible scopes:
Expand Down Expand Up @@ -63,6 +64,9 @@ case ${i} in
--dpns-contract-id=*)
contract_id="${i#*=}"
;;
-t=*|--timeout=*)
timeout="${i#*=}"
;;
esac
done

Expand All @@ -74,6 +78,12 @@ then
exit 1
fi

if [ -n "$timeout" ] && ! [[ $timeout =~ ^[0-9]+$ ]]
then
echo "Timeout must be an integer"
exit 1
fi

if [ -n "$npm_package_to_install" ]
then
npm install "$npm_package_to_install"
Expand Down Expand Up @@ -122,4 +132,38 @@ else
scope_dirs="test/functional/**/*.spec.js test/e2e/**/*.spec.js"
fi

DAPI_SEED=${DAPI_SEED} FAUCET_PRIVATE_KEY=${faucet_key} NETWORK=${network} DPNS_CONTRACT_ID=${contract_id} DPNS_TOP_LEVEL_IDENTITY_ID=${identity_id} DPNS_TOP_LEVEL_IDENTITY_PRIVATE_KEY=${identity_private_key} NODE_ENV=test mocha ${scope_dirs}
cmd="DAPI_SEED=${DAPI_SEED}"

if [ -n "$faucet_key" ]
then
cmd="${cmd} FAUCET_PRIVATE_KEY=${faucet_key}"
fi

if [ -n "$network" ]
then
cmd="${cmd} NETWORK=${network}"
fi

if [ -n "$contract_id" ]
then
cmd="${cmd} DPNS_CONTRACT_ID=${contract_id}"
fi

if [ -n "$identity_id" ]
then
cmd="${cmd} DPNS_TOP_LEVEL_IDENTITY_ID=${identity_id}"
fi

if [ -n "$identity_private_key" ]
then
cmd="${cmd} DPNS_TOP_LEVEL_IDENTITY_PRIVATE_KEY=${identity_private_key}"
fi

cmd="${cmd} NODE_ENV=test mocha ${scope_dirs}"

if [ -n "$timeout" ]
then
cmd="${cmd} --timeout ${timeout}"
fi

eval $cmd

0 comments on commit c165f65

Please sign in to comment.