forked from arshaw/shelljs-live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·54 lines (47 loc) · 1.07 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# start in root
cd "`dirname $0`"
# check a failure run
resD=$(yarn node ./test.js --fatal 2> /dev/null)
exitCode=$?
if [ "$exitCode" == 0 ]; then
echo "Failure code should be given"
exit 1
fi
# check successful run
resA=$(yarn node ./test.js 2> /dev/null)
exitCode=$?
if [ "$exitCode" != 0 ]; then
echo "Failure A"
exit 1
fi
# check another successful run,
# but run a test using the cwd as 'src'
resB=$(yarn node ./test.js --cwd src 2> /dev/null)
exitCode=$?
if [ "$exitCode" != 0 ]; then
echo "Failure B"
exit 1
fi
if [ "$resA" == "$resB" ]; then
echo "Failure, output should differ with different cwd"
exit 1
fi
# check shell evaluation
resC=$(yarn node ./test.js --shell src 2> /dev/null)
exitCode=$?
if [ "$exitCode" != 0 ]; then
echo "Failure C"
exit 1
fi
if [ "$resA" != "$resC" ]; then
echo "Failure, output should be same whether using shell or not"
exit 1
fi
# check a silent run
resC=$(yarn node ./test.js --silent)
if [ -n "$resC" ]; then
echo "Failure, output should be silent"
exit 1
fi
echo "Successfully ran all tests"