Skip to content

Commit 3752aae

Browse files
Merge 9a4f796 into a673aa8
2 parents a673aa8 + 9a4f796 commit 3752aae

15 files changed

+59
-74
lines changed

lib/helper.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
const fs = require('graceful-fs')
44
const path = require('path')
55
const _ = require('lodash')
6-
const useragent = require('useragent')
6+
const useragent = require('ua-parser-js')
77
const Promise = require('bluebird')
88
const mm = require('minimatch')
99

1010
exports.browserFullNameToShort = (fullName) => {
11-
const agent = useragent.parse(fullName)
12-
const isUnknown = agent.family === 'Other' || agent.os.family === 'Other'
13-
return isUnknown ? fullName : `${agent.toAgent()} (${agent.os})`
11+
const au = useragent(fullName)
12+
if (!au.browser.name && !au.browser.version && !au.os.name && !au.os.version) {
13+
return fullName
14+
}
15+
return `${au.browser.name} ${au.browser.version || '0.0.0'} (${au.os.name} ${au.os.version || '0.0.0'})`
1416
}
1517

1618
exports.isDefined = (value) => {

package-lock.json

+5-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@
415415
"socket.io": "2.1.1",
416416
"source-map": "^0.6.1",
417417
"tmp": "0.0.33",
418-
"useragent": "2.3.0"
418+
"ua-parser-js": "0.7.21"
419419
},
420420
"devDependencies": {
421421
"browserify": "^16.2.3",

test/e2e/basic.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Feature: Basic Testrunner
1717
Then it passes with:
1818
"""
1919
..
20-
HeadlessChrome
20+
Chrome Headless
2121
"""
2222
@not-jenkins
2323
Scenario: Execute a test in Chrome

test/e2e/browser_console.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Feature: Browser Console Configuration
128128
When I start Karma
129129
Then the file at test/e2e/console.log contains:
130130
"""
131-
HeadlessChrome
131+
Chrome Headless
132132
"""
133133

134134
Scenario: Execute logging program and disabling terminal
@@ -150,7 +150,7 @@ Feature: Browser Console Configuration
150150
Then it passes with:
151151
"""
152152
.
153-
HeadlessChrome
153+
Chrome Headless
154154
"""
155155

156156
Scenario: Execute logging program and disabling terminal
@@ -170,7 +170,7 @@ Feature: Browser Console Configuration
170170
Then it passes with:
171171
"""
172172
.
173-
HeadlessChrome
173+
Chrome Headless
174174
"""
175175
Scenario: Execute logging program with singleRun
176176
Given a configuration with:

test/e2e/custom-context.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Feature: Custom Context File
1818
Then it passes with:
1919
"""
2020
.
21-
HeadlessChrome
21+
Chrome Headless
2222
"""

test/e2e/files.feature

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Including files
2020
Then it passes with:
2121
"""
2222
.
23-
HeadlessChrome
23+
Chrome Headless
2424
"""
2525

2626
Scenario: Execute a test excluding an explicitly included file
@@ -41,7 +41,7 @@ Feature: Including files
4141
Then it passes with like:
4242
"""
4343
.
44-
HeadlessChrome
44+
Chrome Headless
4545
"""
4646
And it passes with like:
4747
"""
@@ -66,7 +66,7 @@ Feature: Including files
6666
Then it passes with like:
6767
"""
6868
.
69-
HeadlessChrome
69+
Chrome Headless
7070
"""
7171
And it passes with like:
7272
"""
@@ -91,7 +91,7 @@ Feature: Including files
9191
Then it passes with like:
9292
"""
9393
.
94-
HeadlessChrome
94+
Chrome Headless
9595
"""
9696
And it passes with like:
9797
"""
@@ -116,7 +116,7 @@ Feature: Including files
116116
Then it passes with like:
117117
"""
118118
.
119-
HeadlessChrome
119+
Chrome Headless
120120
"""
121121
And it passes with like:
122122
"""
@@ -141,7 +141,7 @@ Feature: Including files
141141
Then it passes with like:
142142
"""
143143
.
144-
HeadlessChrome
144+
Chrome Headless
145145
"""
146146
And it passes with like:
147147
"""
@@ -167,7 +167,7 @@ Feature: Including files
167167
Then it passes with like:
168168
"""
169169
.
170-
HeadlessChrome
170+
Chrome Headless
171171
"""
172172
And it passes with like:
173173
"""

test/e2e/headers.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ Feature: Custom Headers
2222
Then it passes with:
2323
"""
2424
.
25-
HeadlessChrome
25+
Chrome Headless
2626
"""

test/e2e/middleware.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: Middleware
2121
Then it passes with:
2222
"""
2323
.
24-
HeadlessChrome
24+
Chrome Headless
2525
"""
2626

2727
Scenario: Frameworks can add middleware
@@ -40,5 +40,5 @@ Feature: Middleware
4040
Then it passes with:
4141
"""
4242
.
43-
HeadlessChrome
43+
Chrome Headless
4444
"""

test/e2e/proxy.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feature: Proxying
2020
Then it passes with:
2121
"""
2222
.
23-
HeadlessChrome
23+
Chrome Headless
2424
"""
2525

2626
Scenario: Added by a framework
@@ -39,7 +39,7 @@ Feature: Proxying
3939
Then it passes with:
4040
"""
4141
.
42-
HeadlessChrome
42+
Chrome Headless
4343
"""
4444

4545
Scenario: URLRoot
@@ -60,5 +60,5 @@ Feature: Proxying
6060
Then it passes with:
6161
"""
6262
.
63-
HeadlessChrome
63+
Chrome Headless
6464
"""

test/e2e/reconnecting.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ Feature: Passing Options
2222
Then it passes with:
2323
"""
2424
.....
25-
HeadlessChrome
25+
Chrome Headless
2626
"""

test/e2e/runInParent.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: runInParent option
2121
Then it passes with:
2222
"""
2323
..
24-
HeadlessChrome
24+
Chrome Headless
2525
"""
2626
@not-jenkins
2727
Scenario: Execute a test in Chrome

test/e2e/upstream-proxy.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: UpstreamProxy
77
Given a configuration with:
88
"""
99
files = ['behind-proxy/plus.js', 'behind-proxy/test.js'];
10-
browsers = ['ChromeHeadlessNoSandbox'];
10+
browsers = ['ChromeHeadless'];
1111
plugins = [
1212
'karma-jasmine',
1313
'karma-chrome-launcher'
@@ -20,5 +20,5 @@ Feature: UpstreamProxy
2020
When I start Karma behind a proxy on port 9875 that prepends '/__proxy__/' to the base path
2121
Then it passes with regexp:
2222
"""
23-
HeadlessChrome.*Executed.*SUCCESS
23+
Chrome Headless.*Executed.*SUCCESS
2424
"""

test/unit/browser.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Browser', () => {
2828
it('should set fullName and name', () => {
2929
const fullName = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 ' + '(KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7'
3030
browser = new Browser('id', fullName, collection, emitter, socket)
31-
expect(browser.name).to.equal('Chrome 16.0.912 (Mac OS X 10.6.8)')
31+
expect(browser.name).to.equal('Chrome 16.0.912.63 (Mac OS 10.6.8)')
3232
expect(browser.fullName).to.equal(fullName)
3333
})
3434

@@ -66,7 +66,7 @@ describe('Browser', () => {
6666
it('should return browser name', () => {
6767
const fullName = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 ' + '(KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7'
6868
browser = new Browser('id', fullName, collection, emitter, socket)
69-
expect(browser.toString()).to.equal('Chrome 16.0.912 (Mac OS X 10.6.8)')
69+
expect(browser.toString()).to.equal('Chrome 16.0.912.63 (Mac OS 10.6.8)')
7070
})
7171

7272
it('should return verbatim user agent string for unrecognized browser', () => {

0 commit comments

Comments
 (0)