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

Commit b76bfc8

Browse files
evan-duncansjelin
authored andcommitted
feat(output logs): custom instance name
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
1 parent 6ebc4c3 commit b76bfc8

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

docs/referenceConf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ exports.config = {
113113
// like SauceLabs as the name of the job running this test
114114
name: 'Unnamed Job',
115115

116+
// User defined name for the capability that will display in the results log
117+
// Defaults to the browser name
118+
logName: 'Chrome - English',
119+
116120
// Number of times to run this set of capabilities (in parallel, unless
117121
// limited by maxSessions). Default is 1.
118122
count: 1,

lib/launcher.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ var taskResults_ = {
7171
this.results_.forEach(function(result) {
7272
var capabilities = result.capabilities;
7373
var shortName = (capabilities.browserName) ? capabilities.browserName : '';
74+
shortName = (capabilities.logName) ? capabilities.logName
75+
: (capabilities.browserName) ? capabilities.browserName : '';
7476
shortName += (capabilities.version) ? capabilities.version : '';
75-
shortName += (' #' + result.taskId);
77+
shortName += (capabilities.logName && capabilities.count < 2) ?
78+
'' : ' #' + result.taskId;
7679
if (result.failedCount) {
7780
log_(shortName + ' failed ' + result.failedCount + ' test(s)');
7881
} else if (result.exitCode !== 0) {

lib/taskLogger.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,12 @@ TaskLogger.prototype.flush = function() {
5555
TaskLogger.prototype.log = function(data) {
5656
var tag = '[';
5757
var capabilities = this.task.capabilities;
58-
tag += (capabilities.browserName) ?
59-
capabilities.browserName : '';
60-
tag += (capabilities.version) ?
61-
(' ' + capabilities.version) : '';
62-
tag += (capabilities.platform) ?
63-
(' ' + capabilities.platform) : '';
64-
tag += (' #' + this.task.taskId);
58+
tag += (capabilities.logName) ? capabilities.logName
59+
: (capabilities.browserName) ? capabilities.browserName : '';
60+
tag += (capabilities.version) ? (' ' + capabilities.version) : '';
61+
tag += (capabilities.platform) ? (' ' + capabilities.platform) : '';
62+
tag += (capabilities.logName && capabilities.count < 2) ?
63+
'' : ' #' + this.task.taskId;
6564
tag += '] ';
6665

6766
data = data.toString();

0 commit comments

Comments
 (0)