Skip to content

Commit 4e0d482

Browse files
authored
Merge pull request #5997 from whymarrh/drizzle-script
Harden Drizzle test runner script
2 parents dd6d323 + 4d4d4ca commit 4e0d482

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

test/e2e/beta/run-drizzle.sh

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
#!/usr/bin/env bash
22

3-
export PATH="$PATH:./node_modules/.bin"
3+
set -e
4+
set -u
5+
set -o pipefail
46

57
npm run ganache:start -- -b 2 >> /dev/null 2>&1 &
8+
npm_run_ganache_start_pid=$!
69
sleep 5
7-
cd test/e2e/beta/
8-
rm -rf drizzle-test
9-
mkdir drizzle-test && cd drizzle-test
10-
npm install truffle
11-
../../../../node_modules/.bin/truffle unbox drizzle
10+
11+
pushd "$(mktemp -d)"
12+
npm install --no-package-lock truffle
13+
truffle="$(npm bin)/truffle"
14+
$truffle unbox drizzle
1215
echo "Deploying contracts for Drizzle test..."
13-
../../../../node_modules/.bin/truffle compile && ../../../../node_modules/.bin/truffle migrate
16+
$truffle compile
17+
$truffle migrate
18+
1419
BROWSER=none npm start >> /dev/null 2>&1 &
15-
cd ../../../../
16-
mocha test/e2e/beta/drizzle.spec
20+
npm_start_pid=$!
21+
22+
popd
23+
if ! mocha test/e2e/beta/drizzle.spec
24+
then
25+
test_status=1
26+
fi
27+
28+
! kill -15 $npm_run_ganache_start_pid
29+
! kill -15 $npm_start_pid
30+
! wait $npm_run_ganache_start_pid $npm_start_pid
31+
exit ${test_status:-}

0 commit comments

Comments
 (0)