Add -e flag to runtests.sh to stop tests after a given file
This is useful when trying to debug an error that only happens after a number of other tests have run -- specify -e and run tests from either an earlier file with -s or from the beginning.
This commit is contained in:
parent
dcfddac519
commit
c11f1069d7
3 changed files with 13 additions and 1 deletions
|
@ -38,6 +38,7 @@ ZoteroUnit.prototype = {
|
|||
this.runTests = !this.makeTestData;
|
||||
this.bail = cmdLine.handleFlag("bail", false);
|
||||
this.startAt = cmdLine.handleFlagWithParam("startAtTestFile", false);
|
||||
this.stopAt = cmdLine.handleFlagWithParam("stopAtTestFile", false);
|
||||
this.grep = cmdLine.handleFlagWithParam("grep", false);
|
||||
this.timeout = cmdLine.handleFlagWithParam("ZoteroTestTimeout", false);
|
||||
},
|
||||
|
|
|
@ -240,6 +240,7 @@ if(run && ZoteroUnit.tests) {
|
|||
var enumerator = testDirectory.directoryEntries;
|
||||
let startFile = ZoteroUnit.startAt ? getTestFilename(ZoteroUnit.startAt) : false;
|
||||
let started = !startFile;
|
||||
let stopFile = ZoteroUnit.stopAt ? getTestFilename(ZoteroUnit.stopAt) : false;
|
||||
while(enumerator.hasMoreElements()) {
|
||||
var file = enumerator.getNext().QueryInterface(Components.interfaces.nsIFile);
|
||||
if(file.leafName.endsWith(".js")) {
|
||||
|
@ -247,6 +248,9 @@ if(run && ZoteroUnit.tests) {
|
|||
testFiles.push(file.leafName);
|
||||
started = true;
|
||||
}
|
||||
if (file.leafName == stopFile) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!started) {
|
||||
|
|
|
@ -35,6 +35,7 @@ Options
|
|||
-b skip bundled translator/style installation
|
||||
-c open JavaScript console and don't quit on completion
|
||||
-d LEVEL enable debug logging
|
||||
-e TEST end at the given test
|
||||
-f stop after first test failure
|
||||
-g only run tests matching the given pattern (grep)
|
||||
-h display this help
|
||||
|
@ -48,7 +49,7 @@ DONE
|
|||
|
||||
DEBUG=false
|
||||
DEBUG_LEVEL=5
|
||||
while getopts "bcd:fg:hs:tx:" opt; do
|
||||
while getopts "bcd:e:fg:hs:tx:" opt; do
|
||||
case $opt in
|
||||
b)
|
||||
FX_ARGS="$FX_ARGS -ZoteroSkipBundledFiles"
|
||||
|
@ -60,6 +61,12 @@ while getopts "bcd:fg:hs:tx:" opt; do
|
|||
DEBUG=true
|
||||
DEBUG_LEVEL="$OPTARG"
|
||||
;;
|
||||
e)
|
||||
if [[ -z "$OPTARG" ]] || [[ ${OPTARG:0:1} = "-" ]]; then
|
||||
usage
|
||||
fi
|
||||
FX_ARGS="$FX_ARGS -stopAtTestFile $OPTARG"
|
||||
;;
|
||||
f)
|
||||
FX_ARGS="$FX_ARGS -bail"
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue