Add -g flag to run only tests matching a pattern (grep)
(Actually, it's only matching strings for me, not patterns, but according to Mocha it's supposed to compile the patterns using RegExp.)
This commit is contained in:
parent
420985661b
commit
fd45032210
3 changed files with 12 additions and 14 deletions
|
@ -34,6 +34,7 @@ ZoteroUnit.prototype = {
|
||||||
this.tests = cmdLine.handleFlagWithParam("test", false);
|
this.tests = cmdLine.handleFlagWithParam("test", false);
|
||||||
this.noquit = cmdLine.handleFlag("noquit", false);
|
this.noquit = cmdLine.handleFlag("noquit", false);
|
||||||
this.bail = cmdLine.handleFlag("bail", false);
|
this.bail = cmdLine.handleFlag("bail", false);
|
||||||
|
this.grep = cmdLine.handleFlagWithParam("grep", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
dump:function(x) {
|
dump:function(x) {
|
||||||
|
|
|
@ -79,7 +79,8 @@ function Reporter(runner) {
|
||||||
mocha.setup({
|
mocha.setup({
|
||||||
ui: "bdd",
|
ui: "bdd",
|
||||||
reporter: Reporter,
|
reporter: Reporter,
|
||||||
timeout: 5000
|
timeout: 5000,
|
||||||
|
grep: ZoteroUnit.grep
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enable Bluebird generator support in Mocha
|
// Enable Bluebird generator support in Mocha
|
||||||
|
|
|
@ -30,13 +30,14 @@ Options
|
||||||
-d enable debug logging
|
-d enable debug logging
|
||||||
-c open JavaScript console and don't quit on completion
|
-c open JavaScript console and don't quit on completion
|
||||||
-f stop after first test failure
|
-f stop after first test failure
|
||||||
|
-g only run tests matching the given pattern (grep)
|
||||||
-b skip bundled translator/style installation
|
-b skip bundled translator/style installation
|
||||||
TESTS set of tests to run (default: all)
|
TESTS set of tests to run (default: all)
|
||||||
DONE
|
DONE
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "x:dcfb" opt; do
|
while getopts "x:dcfg:b" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
x)
|
x)
|
||||||
FX_EXECUTABLE="$OPTARG"
|
FX_EXECUTABLE="$OPTARG"
|
||||||
|
@ -45,13 +46,16 @@ while getopts "x:dcfb" opt; do
|
||||||
DEBUG=true
|
DEBUG=true
|
||||||
;;
|
;;
|
||||||
c)
|
c)
|
||||||
FX_ARGS="-jsconsole -noquit"
|
FX_ARGS="$FX_ARGS -jsconsole -noquit"
|
||||||
;;
|
;;
|
||||||
f)
|
f)
|
||||||
STOP_ON_FAILURE=true
|
FX_ARGS="$FX_ARGS -bail"
|
||||||
|
;;
|
||||||
|
g)
|
||||||
|
GREP="$OPTARG"
|
||||||
;;
|
;;
|
||||||
b)
|
b)
|
||||||
SKIP_BUNDLED=true
|
FX_ARGS="$FX_ARGS -ZoteroSkipBundledFiles"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
|
@ -101,20 +105,12 @@ if [ "$TRAVIS" = true ]; then
|
||||||
FX_ARGS="$FX_ARGS --ZoteroNoUserInput"
|
FX_ARGS="$FX_ARGS --ZoteroNoUserInput"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SKIP_BUNDLED" = true ]; then
|
|
||||||
FX_ARGS="$FX_ARGS -ZoteroSkipBundledFiles"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$STOP_ON_FAILURE" = true ]; then
|
|
||||||
FX_ARGS="$FX_ARGS -bail"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up on exit
|
# Clean up on exit
|
||||||
trap "{ rm -rf \"$PROFILE\"; }" EXIT
|
trap "{ rm -rf \"$PROFILE\"; }" EXIT
|
||||||
|
|
||||||
makePath FX_PROFILE "$PROFILE"
|
makePath FX_PROFILE "$PROFILE"
|
||||||
MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$FX_EXECUTABLE" -profile "$FX_PROFILE" \
|
MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$FX_EXECUTABLE" -profile "$FX_PROFILE" \
|
||||||
-chrome chrome://zotero-unit/content/runtests.html -test "$TESTS" $FX_ARGS
|
-chrome chrome://zotero-unit/content/runtests.html -test "$TESTS" -grep "$GREP" $FX_ARGS
|
||||||
|
|
||||||
# Check for success
|
# Check for success
|
||||||
test -e "$PROFILE/success"
|
test -e "$PROFILE/success"
|
||||||
|
|
Loading…
Reference in a new issue