Contributor app tests #143

Merged
haythem96 merged 26 commits from tests/contracts-contributor into master 2019-07-22 06:55:23 +00:00
6 changed files with 363 additions and 820 deletions
Showing only changes of commit e4877471ed - Show all commits

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,10 +27,10 @@
"publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major",
"versions": "aragon apm versions",
"test": "TRUFFLE_TEST=true PORT=7545 npm run ganache-cli:test",
"test": "TRUFFLE_TEST=true PORT=8545 npm run ganache-cli:test",
"test:gas": "GAS_REPORTER=true npm test",
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test",
"ganache-cli:test": "./node_modules/@aragon/test-helpers/ganache-cli.sh"
"ganache-cli:test": "../../scripts/ganache-cli.sh"
},
"keywords": []
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

64
scripts/ganache-cli.sh Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
# Exit script as soon as a command fails.
set -o errexit
# Executes cleanup function at script exit.
trap cleanup EXIT
cleanup() {
# Kill the RPC instance that we started (if we started one and if it's still running).
if [ -n "$rpc_pid" ] && ps -p $rpc_pid > /dev/null; then
kill -9 $rpc_pid
fi
}
setup_coverage_variables() {
PORT=${PORT-8555}
BALANCE=${BALANCE-100000}
GAS_LIMIT=${GAS_LIMIT-0xfffffffffff}
NETWORK_ID=${NETWORK_ID-16}
}
setup_testing_variables() {
PORT=${PORT-8545}
BALANCE=${BALANCE-100000}
GAS_LIMIT=${GAS_LIMIT-8000000}
NETWORK_ID=${NETWORK_ID-15}
}
start_ganache() {
echo "Starting ganache-cli..."
npx ganache-cli -i ${NETWORK_ID} -l ${GAS_LIMIT} -e ${BALANCE} -p ${PORT} > /dev/null &
rpc_pid=$!
sleep 3
echo "Running ganache-cli with pid ${rpc_pid} in port ${PORT}"
}
start_testrpc() {
echo "Starting testrpc-sc..."
npx testrpc-sc -i ${NETWORK_ID} -l ${GAS_LIMIT} -e ${BALANCE} -p ${PORT} > /dev/null &
rpc_pid=$!
sleep 3
echo "Running testrpc-sc with pid ${rpc_pid} in port ${PORT}"
}
measure_coverage() {
echo "Measuring coverage..."
npx solidity-coverage "$@"
}
run_tests() {
echo "Running tests..."
npx aragon contracts test --network rpc "$@"
}
if [ "$SOLIDITY_COVERAGE" = true ]; then
setup_coverage_variables
start_testrpc
measure_coverage
else
setup_testing_variables
start_ganache
run_tests
fi