Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
feat(output logs): custom instance name
Browse files Browse the repository at this point in the history
You can now give specific capabilities custom names so the output logs will be
more understandable. For instance, you might name one capability
"Chrome - French" and another "Chrome - English" so that the logs will read:

[Chrome - French] ...
[Chrome - French] ...
[Chrome - French] ...
[Chrome - English] ...
[Chrome - English] ...
[Chrome - English] ...

Instead of just

[chrome #1] ...
[chrome #1] ...
[chrome #1] ...
[chrome #2] ...
[chrome #2] ...
[chrome #2] ...

Closes #2112
  • Loading branch information
evan-duncan authored and sjelin committed Jun 1, 2015
1 parent 6ebc4c3 commit b76bfc8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/referenceConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ exports.config = {
// like SauceLabs as the name of the job running this test
name: 'Unnamed Job',

// User defined name for the capability that will display in the results log
// Defaults to the browser name
logName: 'Chrome - English',

// Number of times to run this set of capabilities (in parallel, unless
// limited by maxSessions). Default is 1.
count: 1,
Expand Down
5 changes: 4 additions & 1 deletion lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ var taskResults_ = {
this.results_.forEach(function(result) {
var capabilities = result.capabilities;
var shortName = (capabilities.browserName) ? capabilities.browserName : '';
shortName = (capabilities.logName) ? capabilities.logName
: (capabilities.browserName) ? capabilities.browserName : '';
shortName += (capabilities.version) ? capabilities.version : '';
shortName += (' #' + result.taskId);
shortName += (capabilities.logName && capabilities.count < 2) ?
'' : ' #' + result.taskId;
if (result.failedCount) {
log_(shortName + ' failed ' + result.failedCount + ' test(s)');
} else if (result.exitCode !== 0) {
Expand Down
13 changes: 6 additions & 7 deletions lib/taskLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ TaskLogger.prototype.flush = function() {
TaskLogger.prototype.log = function(data) {
var tag = '[';
var capabilities = this.task.capabilities;
tag += (capabilities.browserName) ?
capabilities.browserName : '';
tag += (capabilities.version) ?
(' ' + capabilities.version) : '';
tag += (capabilities.platform) ?
(' ' + capabilities.platform) : '';
tag += (' #' + this.task.taskId);
tag += (capabilities.logName) ? capabilities.logName
: (capabilities.browserName) ? capabilities.browserName : '';
tag += (capabilities.version) ? (' ' + capabilities.version) : '';
tag += (capabilities.platform) ? (' ' + capabilities.platform) : '';
tag += (capabilities.logName && capabilities.count < 2) ?
'' : ' #' + this.task.taskId;
tag += '] ';

data = data.toString();
Expand Down

0 comments on commit b76bfc8

Please sign in to comment.