File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed
Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ cleanup_ganache () {
4+ # Kill the ganache instance that we started (if we started one and if it's still running).
5+ if [ -n " $ganache_pid " ] && ps -p $ganache_pid > /dev/null; then
6+ echo " Stopping Ganache... [pid:${ganache_pid} ]"
7+ kill $ganache_pid
8+ echo " Ganache stopped!"
9+ fi
10+ }
11+
12+ ganache_port=7545
13+
14+ ganache_running () {
15+ nc -z localhost " $ganache_port " & > /dev/null
16+ }
17+
18+ start_ganache () {
19+ echo " Starting Ganache..."
20+ ganache-cli --port " $ganache_port " -d -i 42 > /dev/null &
21+ ganache_pid=$!
22+ echo " Ganache started!"
23+ while ! ganache_running; do
24+ sleep 0.1
25+ done
26+ }
27+
28+ trap cleanup_ganache EXIT
29+
30+ if ganache_running; then
31+ echo " Using existing ganache instance on port ${ganache_port} "
32+ else
33+ start_ganache
34+ fi
35+
Original file line number Diff line number Diff line change 22
33set -e
44
5+ . sidejam-setup-ganache
6+
57truffle test --network test && \
68istanbul report text html --include coverage/coverage.json && \
79istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100 --include coverage/coverage.json
Original file line number Diff line number Diff line change 1010 "url" : " git+https://github.com/ConsenSys/web3studio-sidejam.git"
1111 },
1212 "scripts" : {
13- "test" : " truffle-test" ,
13+ "test" : " sidejam- truffle-test" ,
1414 "build" : " truffle compile" ,
1515 "migrate" : " truffle migrate --reset" ,
1616 "truffle" : " truffle"
1919 "url" : " https://github.com/ConsenSys/web3studio-sidejam/issues"
2020 },
2121 "bin" : {
22- "truffle-test" : " ./bin/truffle-test"
22+ "sidejam-truffle-test" : " ./bin/sidejam-truffle-test" ,
23+ "sidejam-setup-ganache" : " ./bin/sidejam-setup-ganache"
2324 },
2425 "dependencies" : {
2526 "istanbul" : " ^0.4.5" ,
You can’t perform that action at this time.
0 commit comments