forked from eugef/node-mocks-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests
executable file
·65 lines (58 loc) · 1.9 KB
/
run-tests
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
#!/bin/sh
#
# This will run the NodeUnit tests. If `nodeunit` isn't installed, type:
#
# sudo npm install nodeunit
# sudo npm install jshint
if type jshint >/dev/null 2>&1
then
FILES="`find examples lib -name '*.js'`"
TMPHINT=/tmp/jshint-results
for FILE in $FILES
do
echo "Analyzing: $FILE"
HIDDEN_EXP="`dirname $FILE`/.`basename $FILE`-exp"
jshint $FILE > $TMPHINT
if [ $? -gt 0 ]
then
if [ -f "$HIDDEN_EXP" ]
then
diff $TMPHINT "$HIDDEN_EXP"
else
cat $TMPHINT
echo
echo "Note: If this is an expected (and accepted) warning, then:"
echo "cp '$TMPHINT' '$HIDDEN_EXP'"
echo
exit 1
fi
fi
done
fi
# Usage: nodeunit [options] testmodule1.js testfolder [...]
# Options:
#
# --config FILE the path to a JSON file with options
# --reporter FILE optional path to a reporter file to customize the output
# --list-reporters list available build-in reporters
# -t name, specify a test to run
# -h, --help display this help and exit
# -v, --version output version information and exit
# Build-in reporters:
# * browser: Browser-based test reporter
# * default: Default tests reporter
# * eclipse: Reporter for eclipse plugin
# * html: Report tests result as HTML
# * junit: jUnit XML test reports
# * machineout: Tests reporter for machinally analysis
# * minimal: Pretty minimal output
# * nested: Nested test reporter
# * skip_passed: Skip passed tests output
# * tap: TAP output
# * verbose: Verbose tests reporter
echo "Executing tests..."
# OPTS="--reporter junit --output test/results"
FILES="`find test -name 'test-*.js'` `find examples -name '*.js'`"
# echo nodeunit $OPTS $FILES
PATH=./node_modules/nodeunit/bin:$PATH
exec nodeunit $OPTS $FILES