Skip to content

Commit d649706

Browse files
author
Brian Chamberlain
committed
Typo fix
1 parent 0dafc1a commit d649706

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+

packages/message-bus/bin/truffle-test renamed to packages/message-bus/bin/sidejam-truffle-test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -e
44

5+
. sidejam-setup-ganache
6+
57
truffle test --network test && \
68
istanbul report text html --include coverage/coverage.json && \
79
istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100 --include coverage/coverage.json

packages/message-bus/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
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"
@@ -19,7 +19,8 @@
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",

0 commit comments

Comments
 (0)