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
|
#!/bin/bash
REL_SCRIPT_DIR="`dirname \"$0\"`"
SCRIPT_DIR="`( cd \"$REL_SCRIPT_DIR\" && pwd )`"
cd $SCRIPT_DIR || {
echo Could not cd to $SCRIPT_DIR from `pwd`
exit 1
}
../../../bin/mocha -R json-stream ./*.js > /tmp/mocha-glob.txt || {
echo Globbing ./*.js in `pwd` failed.
exit 1
}
cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' || {
echo Globbing ./*.js in `pwd` should match glob.js with one test inside.
exit 1
}
../../../bin/mocha -R json-stream ./*-none.js 2> /tmp/mocha-glob.txt && {
echo Globbing './*-none.js' in `pwd` failed.
exit 1
}
cat /tmp/mocha-glob.txt | grep -q -F 'Could not find any test files matching pattern' || {
echo Globbing './*-none.js' in `pwd` should match no files and run no tests.
exit 1
}
../../../bin/mocha -R json-stream ./*.js ./*-none.js >& /tmp/mocha-glob.txt || {
echo Globbing ./*.js ./*-none.js in `pwd` failed.
exit 1
}
cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' &&
cat /tmp/mocha-glob.txt | grep -q -F 'Could not find any test files matching pattern' || {
echo Globbing ./*.js ./*-none.js in `pwd` should match glob.js with one test inside and display one warning for the non-existing file.
exit 1
}
# Globbing in windows command-shell differs completely from unix-style globbing.
# In bash, the shell expands globs and passes the result to executables.
# In windows, the shell passes globs unexpanded, executables do expansion if they support it.
# Adding single-quotes around the glob below makes bash pass glob unexpanded,
# allowing us to test windows-style globbing in bash.
../../../bin/mocha -R json-stream './*.js' > /tmp/mocha-glob.txt || {
echo Globbing './*.js' in `pwd` failed.
exit 1
}
cat /tmp/mocha-glob.txt | grep -q -F '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' || {
echo Globbing './*.js' in `pwd` should match glob.js with one test inside.
exit 1
}
../../../bin/mocha -R json-stream './*-none.js' 2> /tmp/mocha-glob.txt && {
echo Globbing './*-none.js' in `pwd` failed.
exit 1
}
cat /tmp/mocha-glob.txt | grep -q -F 'Could not find any test files matching pattern' || {
echo Globbing './*-none.js' in `pwd` should match no files and run no tests.
exit 1
}
echo Glob-test passed.
|