-
Notifications
You must be signed in to change notification settings - Fork 10
/
run.sh
executable file
·47 lines (39 loc) · 1.08 KB
/
run.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
#!/bin/bash
#
# Run the integration tests.
# Each subdirectory that has a package.json is considered to be an integration test.
#
# Arguments:
# -g <expression> Run only tests matching this expression.
# The expression is passed to egrep -e <expression>.
#
# Example:
# ./run.sh -g jasmine karma-0.12.1.tgz
#
# -> Run jasmine and jasmine_2 tests using Karma from karma-0.12.1.tgz package.
set -xve
# Parse arguments.
GREP=".*"
while getopts "g:" OPTION; do
case "$OPTION" in
g)
GREP="$OPTARG"
;;
esac
done
PKG_TO_OVERRIDE=${@:$OPTIND:1}
# Run all the matching tests.
for DIR in *; do
MATCH_COUNT=$(echo $DIR | egrep -c -e "$GREP" || exit 0)
if [ -f "$DIR/package.json" -a $MATCH_COUNT -gt 0 ]; then
echo "=============================================================="
echo " ${DIR} with ${PKG_TO_OVERRIDE}"
echo "=============================================================="
cd ./$DIR
npm install > /dev/null || exit 1
# Ignore peerdependency issues
npm install ${PKG_TO_OVERRIDE} || true
npm test || exit 1
cd ..
fi
done