X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=phantom-driver.js;h=a78210018270fc41c7d878f830df6e9b84167dfd;hb=e43d4d238ae016b477aee3f60f1707fb4effacd3;hp=009c634c61f0f9007a416cbe0cffea528613a76a;hpb=bff6800b2885c168f3c276b50fa73b7679824067;p=dygraphs.git diff --git a/phantom-driver.js b/phantom-driver.js index 009c634..a782100 100644 --- a/phantom-driver.js +++ b/phantom-driver.js @@ -22,10 +22,16 @@ page.open(url, function(status) { } var testCase, test; - if (phantom.args.length == 1) { - var parts = phantom.args[0].split('.'); + var verbose = false; + var optIdx = 0; + if (phantom.args.length > 0 && phantom.args[0] === "--verbose") { + verbose = true; + optIdx = 1; + } + if (phantom.args.length == optIdx + 1) { + var parts = phantom.args[optIdx].split('.'); if (2 != parts.length) { - console.warn('Usage: phantomjs phantom-driver.js [testCase.test]'); + console.warn('Usage: phantomjs phantom-driver.js [--verbose] [testCase.test]'); phantom.exit(); } testCase = parts[0]; @@ -39,7 +45,7 @@ page.open(url, function(status) { } else if (msg.substr(0, 'Running'.length) == 'Running') { loggingOn = false; } - if (loggingOn) console.log(msg); + if (verbose || loggingOn) console.log(msg); }; page.onError = function (msg, trace) { @@ -80,7 +86,7 @@ page.open(url, function(status) { for (var test in caseResults) { if (caseResults[test] !== true) { num_failing++; - failures.push(testCase + '.' + test + ' failed'); + failures.push(testCase + '.' + test); } else { // console.log(testCase + '.' + test + ' passed'); num_passing++; @@ -179,8 +185,9 @@ RunAllAutoTests(function(num_failing, num_passing) { if (num_failing !== 0) { console.log('FAIL'); phantom.exit(); + } else { + console.log('PASS'); } - console.log('PASS'); phantom.exit(); // This is not yet reliable enough to be useful: