-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.test.sh
executable file
·66 lines (50 loc) · 1.05 KB
/
setup.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
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
set -exo pipefail;
ORIG_DIR=$(pwd)
function finish {
if [ ! $? -eq 0 ] ; then
echo "There are failing tests"
else
echo "All tests passed!"
fi
cd "$ORIG_DIR"
}
trap finish EXIT
function setup {
local FLAG=$1
cd "$(mktemp -d)"
npm init -y
npx $ORIG_DIR $FLAG
ls -a
}
function common_test {
CONFIG_FILE=".releaserc.js"
echo "'$CONFIG_FILE' should exist"
[ -e "$CONFIG_FILE" ]
TRAVIS_FILE=".travis.yml"
echo "'$TRAVIS_FILE' should exist"
[ -e "$TRAVIS_FILE" ]
PEER="semantic-release"
echo "'$PEER' should be installed"
[ -d "node_modules/$PEER" ]
}
function install_test {
setup
common_test
SELF="@eliasnorrby/semantic-release-config"
echo "'$SELF' should be installed"
[ -d "node_modules/$SELF" ]
}
function no_install_test {
setup "--no-install"
common_test
SELF="@eliasnorrby/semantic-release-config"
echo "'$SELF' should not be installed"
[ ! -d "node_modules/$SELF" ]
}
function help_test {
npx $ORIG_DIR --help | grep "Usage"
}
install_test
no_install_test
help_test