Skip to content

Commit 6facb13

Browse files
authored
Merge 40acdb6 into a409696
2 parents a409696 + 40acdb6 commit 6facb13

22 files changed

+623
-298
lines changed

client/karma.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function Karma (socket, iframe, opener, navigator, location, document) {
199199

200200
// Convert all array-like objects to real arrays.
201201
for (var propertyName in originalResult) {
202-
if (originalResult.hasOwnProperty(propertyName)) {
202+
if (Object.prototype.hasOwnProperty.call(originalResult, propertyName)) {
203203
var propertyValue = originalResult[propertyName]
204204

205205
if (Object.prototype.toString.call(propertyValue) === '[object Array]') {

cucumber.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ const options = [
99
]
1010

1111
module.exports = {
12-
'default': options.join(' ')
12+
default: options.join(' ')
1313
}

lib/browser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class Browser {
121121

122122
reconnect (newSocket) {
123123
if (this.state === EXECUTING_DISCONNECTED) {
124-
this.log.debug(`Lost socket connection, but browser continued to execute. Reconnected ` +
124+
this.log.debug('Lost socket connection, but browser continued to execute. Reconnected ' +
125125
`on socket ${newSocket.id}.`)
126126
this.setState(EXECUTING)
127127
} else if ([CONNECTED, CONFIGURING, EXECUTING].includes(this.state)) {

lib/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function normalizeConfig (config, configFilePath) {
162162
config.protocol = 'http:'
163163
}
164164

165-
if (config.proxies && config.proxies.hasOwnProperty(config.urlRoot)) {
165+
if (config.proxies && Object.prototype.hasOwnProperty.call(config.proxies, config.urlRoot)) {
166166
log.warn(`"${config.urlRoot}" is proxied, you should probably change urlRoot to avoid conflicts`)
167167
}
168168

lib/helper.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ exports.mmPatternWeight = (pattern) => {
7272
}
7373

7474
exports.mmComparePatternWeights = (weight1, weight2) => {
75-
let n1, n2, diff
76-
n1 = weight1[0]
77-
n2 = weight2[0]
78-
diff = n1 - n2
75+
const n1 = weight1[0]
76+
const n2 = weight2[0]
77+
const diff = n1 - n2
7978
if (diff !== 0) return diff / Math.abs(diff)
8079
return weight1.length > 1 ? exports.mmComparePatternWeights(weight1.slice(1), weight2.slice(1)) : 0
8180
}

lib/init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ var questions = [{
121121
condition: (answers) => answers.requirejs
122122
}, {
123123
id: 'includedFiles',
124-
question: `Which files do you want to include with <script> tag ?`,
124+
question: 'Which files do you want to include with <script> tag ?',
125125
hint: 'This should be a script that bootstraps your test by configuring Require.js and ' +
126126
'kicking __karma__.start(), probably your test-main.js file.\n' +
127127
'Enter empty string to move to the next question.',

lib/logger.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ function setup (level, colors, appenders) {
2626
const pattern = colors ? constant.COLOR_PATTERN : constant.NO_COLOR_PATTERN
2727
if (appenders) {
2828
// Convert Array to Object for backwards compatibility.
29-
if (appenders['map']) {
29+
if (appenders.map) {
3030
if (appenders.length === 0) {
3131
appenders = [constant.CONSOLE_APPENDER]
3232
}
3333
const v1Appenders = appenders
3434
appenders = {}
3535
v1Appenders.forEach(function (appender, index) {
3636
if (appender.type === 'console') {
37-
appenders['console'] = appender
37+
appenders.console = appender
3838
if (helper.isDefined(appender.layout) && appender.layout.type === 'pattern') {
3939
appender.layout.pattern = pattern
4040
}
@@ -45,15 +45,15 @@ function setup (level, colors, appenders) {
4545
})
4646
}
4747
} else {
48-
appenders = { 'console': constant.CONSOLE_APPENDER }
48+
appenders = { console: constant.CONSOLE_APPENDER }
4949
}
5050

5151
log4js.configure({
5252
appenders: appenders,
5353
categories: {
54-
'default': {
55-
'appenders': Object.keys(appenders),
56-
'level': level
54+
default: {
55+
appenders: Object.keys(appenders),
56+
level: level
5757
}
5858
}
5959
})
@@ -93,7 +93,7 @@ const loggerCache = {}
9393
function create (name, level) {
9494
name = name || 'karma'
9595
let logger
96-
if (loggerCache.hasOwnProperty(name)) {
96+
if (Object.prototype.hasOwnProperty.call(loggerCache, name)) {
9797
logger = loggerCache[name]
9898
} else {
9999
logger = log4js.getLogger(name)

lib/middleware/karma.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ const common = require('./common')
1919

2020
const VERSION = require('../constants').VERSION
2121
const SCRIPT_TYPE = {
22-
'js': 'text/javascript',
23-
'dart': 'application/dart',
24-
'module': 'module'
22+
js: 'text/javascript',
23+
dart: 'application/dart',
24+
module: 'module'
2525
}
2626
const FILE_TYPES = [
2727
'css',
@@ -84,7 +84,7 @@ function createKarmaMiddleware (
8484
request.normalizedUrl = normalizedUrl
8585

8686
let requestUrl = normalizedUrl.replace(/\?.*/, '')
87-
const requestedRangeHeader = request.headers['range']
87+
const requestedRangeHeader = request.headers.range
8888

8989
// redirect /__karma__ to /__karma__ (trailing slash)
9090
if (requestUrl === urlRoot.substr(0, urlRoot.length - 1)) {
@@ -167,9 +167,9 @@ function createKarmaMiddleware (
167167
if (!FILE_TYPES.includes(fileType)) {
168168
if (file.type == null) {
169169
log.warn(
170-
`Unable to determine file type from the file extension, defaulting to js.\n` +
170+
'Unable to determine file type from the file extension, defaulting to js.\n' +
171171
` To silence the warning specify a valid type for ${file.originalPath} in the configuration file.\n` +
172-
` See http://karma-runner.github.io/latest/config/files.html`
172+
' See http://karma-runner.github.io/latest/config/files.html'
173173
)
174174
} else {
175175
log.warn(`Invalid file type (${file.type || 'empty string'}), defaulting to js.`)

lib/middleware/source_files.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function createSourceFilesMiddleware (filesPromise, serveFile, basePath, urlRoot
3232
return filesPromise.then(function (files) {
3333
// TODO(vojta): change served to be a map rather then an array
3434
const file = findByPath(files.served, requestedFilePath) || findByPath(files.served, requestedFilePathUnescaped)
35-
const rangeHeader = request.headers['range']
35+
const rangeHeader = request.headers.range
3636

3737
if (file) {
3838
const acceptEncodingHeader = request.headers['accept-encoding']

lib/preprocessor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function executeProcessor (process, file, content) {
5656

5757
async function runProcessors (preprocessors, file, content) {
5858
try {
59-
for (let process of preprocessors) {
59+
for (const process of preprocessors) {
6060
content = await executeProcessor(process, file, content)
6161
}
6262
} catch (error) {

lib/runner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function run (config, done) {
4141
config = cfg.parseConfig(config.configFile, config)
4242

4343
let exitCode = 1
44-
let emitter = new EventEmitter()
44+
const emitter = new EventEmitter()
4545
const options = {
4646
hostname: config.hostname,
4747
path: config.urlRoot + 'run',

0 commit comments

Comments
 (0)