Contributor app tests #143
278
apps/contribution/package-lock.json
generated
278
apps/contribution/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
281
apps/contributor/package-lock.json
generated
281
apps/contributor/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,10 +27,10 @@
|
|||||||
"publish:minor": "aragon apm publish minor",
|
"publish:minor": "aragon apm publish minor",
|
||||||
"publish:major": "aragon apm publish major",
|
"publish:major": "aragon apm publish major",
|
||||||
"versions": "aragon apm versions",
|
"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",
|
"test:gas": "GAS_REPORTER=true npm test",
|
||||||
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli: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": []
|
"keywords": []
|
||||||
}
|
}
|
||||||
|
278
apps/proposal/package-lock.json
generated
278
apps/proposal/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
278
apps/token/package-lock.json
generated
278
apps/token/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
64
scripts/ganache-cli.sh
Executable file
64
scripts/ganache-cli.sh
Executable 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
|
Loading…
x
Reference in New Issue
Block a user