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.noquit = cmdLine.handleFlag("noquit", false);
|
||||
this.bail = cmdLine.handleFlag("bail", false);
|
||||
this.grep = cmdLine.handleFlagWithParam("grep", false);
|
||||
},
|
||||
|
||||
dump:function(x) {
|
||||
|
|
|
@ -79,7 +79,8 @@ function Reporter(runner) {
|
|||
mocha.setup({
|
||||
ui: "bdd",
|
||||
reporter: Reporter,
|
||||
timeout: 5000
|
||||
timeout: 5000,
|
||||
grep: ZoteroUnit.grep
|
||||
});
|
||||
|
||||
// Enable Bluebird generator support in Mocha
|
||||
|
|
|
@ -30,13 +30,14 @@ Options
|
|||
-d enable debug logging
|
||||
-c open JavaScript console and don't quit on completion
|
||||
-f stop after first test failure
|
||||
-g only run tests matching the given pattern (grep)
|
||||
-b skip bundled translator/style installation
|
||||
TESTS set of tests to run (default: all)
|
||||
DONE
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts "x:dcfb" opt; do
|
||||
while getopts "x:dcfg:b" opt; do
|
||||
case $opt in
|
||||
x)
|
||||
FX_EXECUTABLE="$OPTARG"
|
||||
|
@ -45,13 +46,16 @@ while getopts "x:dcfb" opt; do
|
|||
DEBUG=true
|
||||
;;
|
||||
c)
|
||||
FX_ARGS="-jsconsole -noquit"
|
||||
FX_ARGS="$FX_ARGS -jsconsole -noquit"
|
||||
;;
|
||||
f)
|
||||
STOP_ON_FAILURE=true
|
||||
FX_ARGS="$FX_ARGS -bail"
|
||||
;;
|
||||
g)
|
||||
GREP="$OPTARG"
|
||||
;;
|
||||
b)
|
||||
SKIP_BUNDLED=true
|
||||
FX_ARGS="$FX_ARGS -ZoteroSkipBundledFiles"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
|
@ -101,20 +105,12 @@ if [ "$TRAVIS" = true ]; then
|
|||
FX_ARGS="$FX_ARGS --ZoteroNoUserInput"
|
||||
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
|
||||
trap "{ rm -rf \"$PROFILE\"; }" EXIT
|
||||
|
||||
makePath FX_PROFILE "$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
|
||||
test -e "$PROFILE/success"
|
||||
|
|
Loading…
Reference in a new issue