Skip to content

Commit 052db56

Browse files
committed
Add an easy way to log to the terminal during browser tests.
On the main thread call `driver.log` and the message will output in the terminal with the pdf id and the message. I've been using this a lot when trying to find certain PDFs or logging stats.
1 parent 6a15973 commit 052db56

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/driver.js

+18
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,24 @@ var Driver = (function DriverClosure() {
466466
}, this.delay);
467467
},
468468

469+
/**
470+
* A debugging tool to log to the terminal while tests are running.
471+
* XXX: This isn't currently referenced, but it's useful for debugging so
472+
* do not remove it.
473+
*
474+
* @param {string} msg - The message to log, it will be prepended with the
475+
* current PDF ID if there is one.
476+
*/
477+
log(msg) {
478+
let id = this.browser;
479+
const task = this.manifest[this.currentTask];
480+
if (task) {
481+
id += `-${task.id}`;
482+
}
483+
484+
this._info(`${id}: ${msg}`);
485+
},
486+
469487
_nextTask() {
470488
let failure = "";
471489

0 commit comments

Comments
 (0)