Skip to content

Commit 9d97226

Browse files
committed
fix(cli): print UserAgent string verbatim if from an unknown browser
output UserAgent string verbatim instead of the unhelpful "Other 0.0.0 (Other)"
1 parent 1c233a0 commit 9d97226

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var useragent = require('useragent')
55

66
exports.browserFullNameToShort = function (fullName) {
77
var agent = useragent.parse(fullName)
8-
return agent.toAgent() + ' (' + agent.os + ')'
8+
return agent.family !== 'Other' ? agent.toAgent() + ' (' + agent.os + ')' : fullName;
99
}
1010

1111
exports.isDefined = function (value) {

test/unit/browser.spec.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ describe 'Browser', ->
6464
browser = new Browser 'id', fullName, collection, emitter, socket
6565
expect(browser.toString()).to.equal 'Chrome 16.0.912 (Mac OS X 10.6.8)'
6666

67+
it 'should return verbatim user agent string for unrecognized browser', ->
68+
fullName = 'NonexistentBot/1.2.3'
69+
browser = new Browser 'id', fullName, collection, emitter, socket
70+
expect(browser.toString()).to.equal 'NonexistentBot/1.2.3'
71+
6772

6873
#==========================================================================
6974
# Browser.onKarmaError

0 commit comments

Comments
 (0)