diff --git a/test/components/zotero-unit.js b/test/components/zotero-unit.js index 0f9d48c4b..bfe8a7424 100644 --- a/test/components/zotero-unit.js +++ b/test/components/zotero-unit.js @@ -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); }, diff --git a/test/content/runtests.js b/test/content/runtests.js index ab06d519e..c9bcdfb43 100644 --- a/test/content/runtests.js +++ b/test/content/runtests.js @@ -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) { diff --git a/test/runtests.sh b/test/runtests.sh index df437c97d..9fe07554b 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -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" ;;