' is not visible because it has CSS property: 'display: none'
})
it('attr, not attr', function () {
- expect(this.$div).to.have.attr('foo') //# 1
- expect(this.$div).to.have.attr('foo', 'bar') //# 2
- expect(this.$div).not.to.have.attr('bar') //# 3
- expect(this.$div).not.to.have.attr('bar', 'baz') //# 4
- expect(this.$div).not.to.have.attr('foo', 'baz') //# 5
+ expect(this.$div).to.have.attr('foo') // 1
+ expect(this.$div).to.have.attr('foo', 'bar') // 2
+ expect(this.$div).not.to.have.attr('bar') // 3
+ expect(this.$div).not.to.have.attr('bar', 'baz') // 4
+ expect(this.$div).not.to.have.attr('foo', 'baz') // 5
- expect(this.$a).to.have.attr('href').and.match(/google/) //# 6, 7
+ expect(this.$a).to.have.attr('href').and.match(/google/) // 6, 7
expect(this.$a)
- .to.have.attr('href', 'https://google.com') //# 8
- .and.have.text('google') //# 9
+ .to.have.attr('href', 'https://google.com') // 8
+ .and.have.text('google') // 9
try {
- expect(this.$a).not.to.have.attr('href', 'https://google.com') //# 10
+ expect(this.$a).not.to.have.attr('href', 'https://google.com') // 10
} catch (error) {} // eslint-disable-line no-empty
expect(this.logs.length).to.eq(10)
@@ -2425,21 +2425,21 @@ This element '
' is not visible because it has CSS property: 'display: none'
})
it('prop, not prop', function () {
- expect(this.$input).to.have.prop('checked') //# 1
- expect(this.$input).to.have.prop('checked', true) //# 2
- expect(this.$input).not.to.have.prop('bar') //# 3
- expect(this.$input).not.to.have.prop('bar', 'baz') //# 4
- expect(this.$input).not.to.have.prop('checked', 'baz') //# 5
+ expect(this.$input).to.have.prop('checked') // 1
+ expect(this.$input).to.have.prop('checked', true) // 2
+ expect(this.$input).not.to.have.prop('bar') // 3
+ expect(this.$input).not.to.have.prop('bar', 'baz') // 4
+ expect(this.$input).not.to.have.prop('checked', 'baz') // 5
const href = `${window.location.origin}/foo`
- expect(this.$a).to.have.prop('href').and.match(/foo/) //# 6, 7
+ expect(this.$a).to.have.prop('href').and.match(/foo/) // 6, 7
expect(this.$a)
- .to.have.prop('href', href) //# 8
- .and.have.text('google') //# 9
+ .to.have.prop('href', href) // 8
+ .and.have.text('google') // 9
try {
- expect(this.$a).not.to.have.prop('href', href) //# 10
+ expect(this.$a).not.to.have.prop('href', href) // 10
} catch (error) {} // eslint-disable-line no-empty
expect(this.logs.length).to.eq(10)
@@ -2522,14 +2522,14 @@ This element '
' is not visible because it has CSS property: 'display: none'
})
it('css, not css', function () {
- expect(this.$div).to.have.css('display') //# 1
- expect(this.$div).to.have.css('display', 'none') //# 2
- expect(this.$div).not.to.have.css('bar') //# 3
- expect(this.$div).not.to.have.css('bar', 'baz') //# 4
- expect(this.$div).not.to.have.css('display', 'inline') //# 5
+ expect(this.$div).to.have.css('display') // 1
+ expect(this.$div).to.have.css('display', 'none') // 2
+ expect(this.$div).not.to.have.css('bar') // 3
+ expect(this.$div).not.to.have.css('bar', 'baz') // 4
+ expect(this.$div).not.to.have.css('display', 'inline') // 5
try {
- expect(this.$div).not.to.have.css('display', 'none') //# 6
+ expect(this.$div).not.to.have.css('display', 'none') // 6
} catch (error) {} // eslint-disable-line no-empty
expect(this.logs.length).to.eq(6)
diff --git a/packages/server/lib/util/app_data.js b/packages/server/lib/util/app_data.js
index aa147615ff..b286d8c1ee 100644
--- a/packages/server/lib/util/app_data.js
+++ b/packages/server/lib/util/app_data.js
@@ -1,10 +1,3 @@
-// TODO: This file was created by bulk-decaffeinate.
-// Sanity-check the conversion and remove this comment.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const os = require('os')
const path = require('path')
const ospath = require('ospath')
@@ -25,7 +18,7 @@ if (!PRODUCT_NAME) {
throw new Error('Root package is missing name')
}
-const getSymlinkType = function () {
+const getSymlinkType = () => {
if (os.platform() === 'win32') {
return 'junction'
}
@@ -49,7 +42,7 @@ module.exports = {
})
}
- //# try twice to ensure the dir
+ // try twice to ensure the dir
return ensure()
.catch(ensure)
},
@@ -74,7 +67,7 @@ module.exports = {
la(check.unemptyString(env.CYPRESS_ENV),
'expected CYPRESS_ENV, found', env.CYPRESS_ENV)
- //# allow overriding the app_data folder
+ // allow overriding the app_data folder
const folder = env.CYPRESS_KONFIG_ENV || env.CYPRESS_ENV
const p = path.join(ELECTRON_APP_DATA_PATH, 'cy', folder, ...paths)
diff --git a/packages/server/lib/util/args.js b/packages/server/lib/util/args.js
index f3bca38f71..bff080b3dc 100644
--- a/packages/server/lib/util/args.js
+++ b/packages/server/lib/util/args.js
@@ -13,7 +13,7 @@ const everythingAfterFirstEqualRe = /=(.*)/
const whitelist = 'appPath apiKey browser ci ciBuildId clearLogs config configFile cwd env execPath exit exitWithCode generateKey getKey group headed inspectBrk key logs mode outputPath parallel ping port project proxySource record reporter reporterOptions returnPkg runMode runProject smokeTest spec tag updating version'.split(' ')
// returns true if the given string has double quote character "
// only at the last position.
-const hasStrayEndQuote = function (s) {
+const hasStrayEndQuote = (s) => {
const quoteAt = s.indexOf('"')
return quoteAt === (s.length - 1)
@@ -23,7 +23,7 @@ const removeLastCharacter = (s) => {
return s.substr(0, s.length - 1)
}
-const normalizeBackslash = function (s) {
+const normalizeBackslash = (s) => {
if (hasStrayEndQuote(s)) {
return removeLastCharacter(s)
}
@@ -31,7 +31,7 @@ const normalizeBackslash = function (s) {
return s
}
-const normalizeBackslashes = function (options) {
+const normalizeBackslashes = (options) => {
// remove stray double quote from runProject and other path properties
// due to bug in NPM passing arguments with
// backslash at the end
@@ -48,7 +48,7 @@ const normalizeBackslashes = function (options) {
return options
}
-const stringify = function (val) {
+const stringify = (val) => {
if (_.isObject(val)) {
return JSON.stringify(val)
}
@@ -56,7 +56,7 @@ const stringify = function (val) {
return val
}
-const strToArray = function (str) {
+const strToArray = (str) => {
const parsed = tryJSONParse(str)
if (parsed) {
@@ -67,7 +67,7 @@ const strToArray = function (str) {
}
// swap out comma's for bars
-const commasToPipes = (match, p1, p2, p3) => {
+const commasToPipes = (match) => {
return match.split(',').join('|')
}
@@ -77,7 +77,7 @@ const pipesToCommas = (str) => {
return str.split('|').join(',')
}
-const tryJSONParse = function (str) {
+const tryJSONParse = (str) => {
try {
return JSON.parse(str)
} catch (err) {
@@ -85,7 +85,7 @@ const tryJSONParse = function (str) {
}
}
-const JSONOrCoerce = function (str) {
+const JSONOrCoerce = (str) => {
// valid JSON? horray
const parsed = tryJSONParse(str)
@@ -107,7 +107,7 @@ const JSONOrCoerce = function (str) {
return coerceUtil(str)
}
-const sanitizeAndConvertNestedArgs = function (str) {
+const sanitizeAndConvertNestedArgs = (str) => {
// if this is valid JSON then just
// parse it and call it a day
const parsed = tryJSONParse(str)
diff --git a/packages/server/lib/util/ci_provider.js b/packages/server/lib/util/ci_provider.js
index 3a9af4f555..94278a35ca 100644
--- a/packages/server/lib/util/ci_provider.js
+++ b/packages/server/lib/util/ci_provider.js
@@ -99,7 +99,7 @@ const CI_PROVIDERS = {
'wercker': isWercker,
}
-const _detectProviderName = function () {
+const _detectProviderName = () => {
const { env } = process
// return the key of the first provider
@@ -338,7 +338,7 @@ const _providerCiParams = () => {
// tries to grab commit information from CI environment variables
// very useful to fill missing information when Git cannot grab correct values
-const _providerCommitParams = function () {
+const _providerCommitParams = () => {
const { env } = process
return {
@@ -500,11 +500,11 @@ const _providerCommitParams = function () {
}
}
-const provider = function () {
+const provider = () => {
return _detectProviderName() || null
}
-const omitUndefined = function (ret) {
+const omitUndefined = (ret) => {
if (_.isObject(ret)) {
return _.omitBy(ret, _.isUndefined)
}
@@ -527,7 +527,7 @@ const commitParams = () => {
return _get(_providerCommitParams)
}
-const commitDefaults = function (existingInfo) {
+const commitDefaults = (existingInfo) => {
debug('git commit existing info')
debug(existingInfo)
diff --git a/packages/server/lib/util/coerce.js b/packages/server/lib/util/coerce.js
index 03cea4348a..4794d9dbe1 100644
--- a/packages/server/lib/util/coerce.js
+++ b/packages/server/lib/util/coerce.js
@@ -7,7 +7,7 @@ const isValue = (value) => {
}
}
-module.exports = function (value) {
+module.exports = (value) => {
const num = _.toNumber(value)
const bool = toBoolean(value)
diff --git a/packages/server/lib/util/file.js b/packages/server/lib/util/file.js
index 7270f04c53..ef8c88ddad 100644
--- a/packages/server/lib/util/file.js
+++ b/packages/server/lib/util/file.js
@@ -93,10 +93,10 @@ class File {
}
_getContents () {
- //# read from disk on first call, but resolve cache for any subsequent
- //# calls within the DEBOUNCE_LIMIT
- //# once the DEBOUNCE_LIMIT passes, read from disk again
- //# on the next call
+ // read from disk on first call, but resolve cache for any subsequent
+ // calls within the DEBOUNCE_LIMIT
+ // once the DEBOUNCE_LIMIT passes, read from disk again
+ // on the next call
if ((Date.now() - this._lastRead) > DEBOUNCE_LIMIT) {
this._lastRead = Date.now()
@@ -117,11 +117,11 @@ class File {
return fs.readJsonAsync(this.path, 'utf8')
})
.catch((err) => {
- //# default to {} in certain cases, otherwise bubble up error
+ // default to {} in certain cases, otherwise bubble up error
if (
- (err.code === 'ENOENT') || //# file doesn't exist
- (err.code === 'EEXIST') || //# file contains invalid JSON
- (err.name === 'SyntaxError') //# can't get lock on file
+ (err.code === 'ENOENT') || // file doesn't exist
+ (err.code === 'EEXIST') || // file contains invalid JSON
+ (err.name === 'SyntaxError') // can't get lock on file
) {
return {}
}
@@ -142,17 +142,15 @@ class File {
throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got \`${type}\``)
}
- const valueObject = (() => {
- if (_.isString(key)) {
- const tmp = {}
+ let valueObject = key
- tmp[key] = value
+ if (_.isString(key)) {
+ const tmp = {}
- return tmp
- }
+ tmp[key] = value
- return key
- })()
+ valueObject = tmp
+ }
if (inTransaction) {
return this._setContents(valueObject)
@@ -177,7 +175,7 @@ class File {
}
_addToQueue (operation) {
- //# queues operations so they occur serially as invoked
+ // queues operations so they occur serially as invoked
return Promise.try(() => {
return this._queue.add(operation)
})
@@ -203,7 +201,7 @@ class File {
return fs
.ensureDirAsync(this._lockFileDir)
.then(() => {
- //# polls every 100ms up to 2000ms to obtain lock, otherwise rejects
+ // polls every 100ms up to 2000ms to obtain lock, otherwise rejects
return lockFile.lockAsync(this._lockFilePath, { wait: LOCK_TIMEOUT })
})
.finally(() => {
@@ -217,7 +215,7 @@ class File {
return lockFile
.unlockAsync(this._lockFilePath)
.timeout(env.get('FILE_UNLOCK_TIMEOUT') || LOCK_TIMEOUT)
- .catch(Promise.TimeoutError, () => {}) //# ignore timeouts
+ .catch(Promise.TimeoutError, () => {}) // ignore timeouts
.finally(() => {
return debug('unlock succeeded or failed for %s', this.path)
})
diff --git a/packages/server/lib/util/fs.js b/packages/server/lib/util/fs.js
index cc05d9cf60..91213ee7b2 100644
--- a/packages/server/lib/util/fs.js
+++ b/packages/server/lib/util/fs.js
@@ -3,8 +3,8 @@
const fs = require('fs-extra')
const Promise = require('bluebird')
-//# warn users if somehow synchronous file methods are invoked
-//# these methods due to "too many files" errors are a huge pain
+// warn users if somehow synchronous file methods are invoked
+// these methods due to "too many files" errors are a huge pain
const warnOnSyncFileSystem = () => {
console.error('WARNING: fs sync methods can fail due to EMFILE errors')
console.error('Cypress only works reliably when ALL fs calls are async')
diff --git a/packages/server/lib/util/human_time.js b/packages/server/lib/util/human_time.js
index e44129e4da..10366c2c06 100644
--- a/packages/server/lib/util/human_time.js
+++ b/packages/server/lib/util/human_time.js
@@ -1,13 +1,9 @@
const moment = require('moment')
-const parse = function (ms) {
- let mins = 0
-
+const parse = (ms) => {
const duration = moment.duration(ms)
-
const hours = duration.hours()
-
- mins = hours * 60
+ let mins = hours * 60
return {
mins,
@@ -16,12 +12,11 @@ const parse = function (ms) {
}
}
-const long = function (ms, alwaysIncludeSeconds = true) {
+const long = (ms, alwaysIncludeSeconds = true) => {
+ let { mins, duration } = parse(ms)
let word
const msg = []
- let { mins, duration } = parse(ms)
-
mins += duration.minutes()
if (mins) {
@@ -39,10 +34,9 @@ const long = function (ms, alwaysIncludeSeconds = true) {
return msg.join(', ')
}
-const short = function (ms) {
- const msg = []
-
+const short = (ms) => {
let { mins, duration } = parse(ms)
+ const msg = []
mins += duration.minutes()
diff --git a/packages/server/lib/util/open.js b/packages/server/lib/util/open.js
index 331827f61c..2a1f6b8555 100644
--- a/packages/server/lib/util/open.js
+++ b/packages/server/lib/util/open.js
@@ -1,11 +1,4 @@
-// TODO: This file was created by bulk-decaffeinate.
-// Sanity-check the conversion and remove this comment.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
-//# wrapper around opn due to issues with proxyquire + istanbul
+// wrapper around opn due to issues with proxyquire + istanbul
const os = require('os')
const opn = require('opn')
diff --git a/packages/server/lib/util/path_helpers.js b/packages/server/lib/util/path_helpers.js
index 702c327016..8c5f957613 100644
--- a/packages/server/lib/util/path_helpers.js
+++ b/packages/server/lib/util/path_helpers.js
@@ -1,19 +1,7 @@
-/* eslint-disable
- no-unused-vars,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const path = require('path')
-const Promise = require('bluebird')
const fs = require('./fs')
const isIntegrationTestRe = /^integration/
-const isUnitTestRe = /^unit/
// require.resolve walks the symlinks, which can really change
// the results. For example
@@ -36,7 +24,7 @@ const checkIfResolveChangedRootFolder = (resolved, initial) => {
// real folder path found could be different due to symlinks
// For example, folder /tmp/foo on Mac is really /private/tmp/foo
-const getRealFolderPath = function (folder) {
+const getRealFolderPath = (folder) => {
// TODO check if folder is a non-empty string
if (!folder) {
throw new Error('Expected folder')
@@ -45,13 +33,13 @@ const getRealFolderPath = function (folder) {
return fs.realpathAsync(folder)
}
-const getRelativePathToSpec = function (spec) {
+const getRelativePathToSpec = (spec) => {
switch (false) {
- //# if our file is an integration test
- //# then figure out the absolute path
- //# to it
+ // if our file is an integration test
+ // then figure out the absolute path
+ // to it
case !isIntegrationTestRe.test(spec):
- //# strip off the integration part
+ // strip off the integration part
return path.relative('integration', spec)
default:
return spec
@@ -67,24 +55,24 @@ module.exports = {
getAbsolutePathToSpec (spec, config) {
switch (false) {
- //# if our file is an integration test
- //# then figure out the absolute path
- //# to it
+ // if our file is an integration test
+ // then figure out the absolute path
+ // to it
case !isIntegrationTestRe.test(spec):
spec = getRelativePathToSpec(spec)
- //# now simply join this with our integrationFolder
- //# which makes it an absolute path
+ // now simply join this with our integrationFolder
+ // which makes it an absolute path
return path.join(config.integrationFolder, spec)
- // ## commented out until we implement unit testing
+ // // commented out until we implement unit testing
// when isUnitTestRe.test(spec)
- //# strip off the unit part
+ // // strip off the unit part
// spec = path.relative("unit", spec)
- // ## now simply resolve this with our unitFolder
- // ## which makes it an absolute path
+ // // now simply resolve this with our unitFolder
+ // // which makes it an absolute path
// path.join(config.unitFolder, spec)
default:
diff --git a/packages/server/lib/util/random.js b/packages/server/lib/util/random.js
index c85cf01a98..577e235ae3 100644
--- a/packages/server/lib/util/random.js
+++ b/packages/server/lib/util/random.js
@@ -1,18 +1,7 @@
-/* eslint-disable
- brace-style,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const random = require('randomstring')
-const id = (length = 5) =>
-//# return a random id
-{
+// return a random id
+const id = (length = 5) => {
return random.generate({
length,
capitalization: 'lowercase',
diff --git a/packages/server/lib/util/routes.js b/packages/server/lib/util/routes.js
index 3dd2188b0a..787cc3f3ce 100644
--- a/packages/server/lib/util/routes.js
+++ b/packages/server/lib/util/routes.js
@@ -1,13 +1,3 @@
-/* eslint-disable
- default-case,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const _ = require('lodash')
const UrlParse = require('url-parse')
const konfig = require('../konfig')
@@ -35,12 +25,16 @@ let routes = {
const parseArgs = function (url, args = []) {
_.each(args, (value) => {
- switch (false) {
- case !_.isObject(value):
- return url.set('query', _.extend(url.query, value))
+ if (_.isObject(value)) {
+ url.set('query', _.extend(url.query, value))
- case !_.isString(value) && !_.isNumber(value):
- return url.set('pathname', url.pathname.replace(':id', value))
+ return
+ }
+
+ if (_.isString(value) || _.isNumber(value)) {
+ url.set('pathname', url.pathname.replace(':id', value))
+
+ return
}
})
@@ -63,7 +57,6 @@ routes = _.reduce(routes, (memo, value, key) => {
}
return memo
-}
-, {})
+}, {})
module.exports = routes
diff --git a/packages/server/lib/util/saved_state.js b/packages/server/lib/util/saved_state.js
index 3dc45df70e..db73b6f36d 100644
--- a/packages/server/lib/util/saved_state.js
+++ b/packages/server/lib/util/saved_state.js
@@ -1,10 +1,3 @@
-// TODO: This file was created by bulk-decaffeinate.
-// Sanity-check the conversion and remove this comment.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const md5 = require('md5')
const path = require('path')
const debug = require('debug')('cypress:server:saved_state')
@@ -13,7 +6,7 @@ const sanitize = require('sanitize-filename')
const cwd = require('../cwd')
const fs = require('../util/fs')
-const toHashName = function (projectRoot) {
+const toHashName = (projectRoot) => {
if (!projectRoot) {
throw new Error('Missing project path')
}
diff --git a/packages/server/lib/util/server_destroy.js b/packages/server/lib/util/server_destroy.js
index 92d45668f8..9fe8738512 100644
--- a/packages/server/lib/util/server_destroy.js
+++ b/packages/server/lib/util/server_destroy.js
@@ -6,7 +6,6 @@ module.exports = function (server) {
server.destroyAsync = () => {
return Promise.promisify(server.destroy)()
- .catch(() => {})
+ .catch(() => {}) // dont catch any errors
}
}
-// dont catch any errors
diff --git a/packages/server/lib/util/settings.js b/packages/server/lib/util/settings.js
index def3b56fb9..937f8513f0 100644
--- a/packages/server/lib/util/settings.js
+++ b/packages/server/lib/util/settings.js
@@ -1,15 +1,3 @@
-/* eslint-disable
- brace-style,
- no-cond-assign,
- no-unused-vars,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const _ = require('lodash')
const Promise = require('bluebird')
const path = require('path')
@@ -17,18 +5,14 @@ const errors = require('../errors')
const log = require('../log')
const fs = require('../util/fs')
-//# TODO:
-//# think about adding another PSemaphore
-//# here since we can read + write the
-//# settings at the same time something else
-//# is potentially reading it
+// TODO:
+// think about adding another PSemaphore
+// here since we can read + write the
+// settings at the same time something else
+// is potentially reading it
-const flattenCypress = function (obj) {
- let cypress
-
- if (cypress = obj.cypress) {
- return cypress
- }
+const flattenCypress = (obj) => {
+ return obj.cypress ? obj.cypress : undefined
}
const maybeVerifyConfigFile = Promise.method((configFile) => {
@@ -39,10 +23,10 @@ const maybeVerifyConfigFile = Promise.method((configFile) => {
return fs.statAsync(configFile)
})
-const renameVisitToPageLoad = function (obj) {
- let v
+const renameVisitToPageLoad = (obj) => {
+ const v = obj.visitTimeout
- if (v = obj.visitTimeout) {
+ if (v) {
obj = _.omit(obj, 'visitTimeout')
obj.pageLoadTimeout = v
@@ -50,10 +34,10 @@ const renameVisitToPageLoad = function (obj) {
}
}
-const renameCommandTimeout = function (obj) {
- let c
+const renameCommandTimeout = (obj) => {
+ const c = obj.commandTimeout
- if (c = obj.commandTimeout) {
+ if (c) {
obj = _.omit(obj, 'commandTimeout')
obj.defaultCommandTimeout = c
@@ -61,10 +45,10 @@ const renameCommandTimeout = function (obj) {
}
}
-const renameSupportFolder = function (obj) {
- let sf
+const renameSupportFolder = (obj) => {
+ const sf = obj.supportFolder
- if (sf = obj.supportFolder) {
+ if (sf) {
obj = _.omit(obj, 'supportFolder')
obj.supportFile = sf
@@ -103,15 +87,10 @@ module.exports = {
_applyRewriteRules (obj = {}) {
return _.reduce([flattenCypress, renameVisitToPageLoad, renameCommandTimeout, renameSupportFolder], (memo, fn) => {
- let ret
+ const ret = fn(memo)
- if (ret = fn(memo)) {
- return ret
- }
-
- return memo
- }
- , _.cloneDeep(obj))
+ return ret ? ret : memo
+ }, _.cloneDeep(obj))
},
configFile (options = {}) {
@@ -133,12 +112,11 @@ module.exports = {
// first check if cypress.json exists
return maybeVerifyConfigFile(file)
- .then(() =>
- // if it does also check that the projectRoot
- // directory is writable
- {
+ .then(() => {
+ // if it does also check that the projectRoot
+ // directory is writable
return fs.accessAsync(projectRoot, fs.W_OK)
- }).catch({ code: 'ENOENT' }, (err) => {
+ }).catch({ code: 'ENOENT' }, () => {
// cypress.json does not exist, we missing project
log('cannot find file %s', file)
@@ -166,13 +144,13 @@ module.exports = {
}).then((json = {}) => {
const changed = this._applyRewriteRules(json)
- //# if our object is unchanged
- //# then just return it
+ // if our object is unchanged
+ // then just return it
if (_.isEqual(json, changed)) {
return json
}
- //# else write the new reduced obj
+ // else write the new reduced obj
return this._write(file, changed)
}).catch((err) => {
if (errors.isCypressErr(err)) {
diff --git a/packages/server/lib/util/shell.js b/packages/server/lib/util/shell.js
index 36c31f639f..c0208134a1 100644
--- a/packages/server/lib/util/shell.js
+++ b/packages/server/lib/util/shell.js
@@ -1,14 +1,3 @@
-/* eslint-disable
- no-cond-assign,
- no-dupe-keys,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const Promise = require('bluebird')
const execa = require('execa')
const R = require('ramda')
@@ -20,21 +9,20 @@ const isWindows = () => {
}
const profiles = {
- '~/.profile': /\/sh$/,
+ '~/.profile': /\/k?sh$/,
'~/.bash_profile': /\/bash$/,
'~/.cshrc': /\/csh$/,
- '~/.profile': /\/ksh$/,
'~/.zshrc': /\/zsh$/,
'~/.config/fish/config.fish': /\/fish$/,
}
let sourcedProfiles = []
-//# returns true if Cypress application has been started from
-//# the terminal shell.
-//# returns false if Cypress application has been started
-//# from the Finder / Windows Explorer list
-//# by double clicking its icon
+// returns true if Cypress application has been started from
+// the terminal shell.
+// returns false if Cypress application has been started
+// from the Finder / Windows Explorer list
+// by double clicking its icon
const startedNormally = () => {
return Boolean(process.env._)
}
@@ -66,16 +54,16 @@ const sourceShellCommand = function (cmd, shell) {
const haveShell = startedNormally()
if (haveShell) {
- //# we only need to source once
- //# IF THE APP HAS NOT BEEN STARTED BY
- //# DOUBLE CLICKING IT FROM FINDER / WINDOWS EXPLORER
- //# OTHERWISE NEED TO SOURCE EVERY COMMAND
+ // we only need to source once
+ // IF THE APP HAS NOT BEEN STARTED BY
+ // DOUBLE CLICKING IT FROM FINDER / WINDOWS EXPLORER
+ // OTHERWISE NEED TO SOURCE EVERY COMMAND
sourcedProfiles.push(profilePath)
}
- //# sourcing the profile can output un-needed garbage,
- //# so suppress it by sending it to /dev/null and ignore
- //# any failures with this
+ // sourcing the profile can output un-needed garbage,
+ // so suppress it by sending it to /dev/null and ignore
+ // any failures with this
return `source ${profilePath} > /dev/null 2>&1; ${cmd}`
}
@@ -85,15 +73,15 @@ const findBash = () => {
}
const getShell = function (shell) {
- let s
-
if (shell) {
return Promise.resolve(shell)
}
- //# if we didn't get a shell such
- //# as when we're in docker
- if (s = process.env.SHELL) {
+ // if we didn't get a shell such
+ // as when we're in docker
+ let s = process.env.SHELL
+
+ if (s) {
return Promise.resolve(s)
}
diff --git a/packages/server/lib/util/specs.js b/packages/server/lib/util/specs.js
index bee7d99f0e..b54d790d8c 100644
--- a/packages/server/lib/util/specs.js
+++ b/packages/server/lib/util/specs.js
@@ -1,13 +1,3 @@
-/* eslint-disable
- brace-style,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const _ = require('lodash')
const la = require('lazy-ass')
const path = require('path')
@@ -46,10 +36,10 @@ const find = function findSpecs (config, specPattern) {
debug('there is no spec pattern')
}
- //# support files are not automatically
- //# ignored because only _fixtures are hard
- //# coded. the rest is simply whatever is in
- //# the javascripts array
+ // support files are not automatically
+ // ignored because only _fixtures are hard
+ // coded. the rest is simply whatever is in
+ // the javascripts array
if (config.fixturesFolder) {
fixturesFolderPath = path.join(
@@ -61,15 +51,15 @@ const find = function findSpecs (config, specPattern) {
const supportFilePath = config.supportFile || []
- //# map all of the javascripts to the project root
- //# TODO: think about moving this into config
- //# and mapping each of the javascripts into an
- //# absolute path
+ // map all of the javascripts to the project root
+ // TODO: think about moving this into config
+ // and mapping each of the javascripts into an
+ // absolute path
const javascriptsPaths = _.map(config.javascripts, (js) => {
return path.join(config.projectRoot, js)
})
- //# ignore fixtures + javascripts
+ // ignore fixtures + javascripts
const options = {
sort: true,
absolute: true,
@@ -82,10 +72,10 @@ const find = function findSpecs (config, specPattern) {
])),
}
- //# filePath = /Users/bmann/Dev/my-project/cypress/integration/foo.coffee
- //# integrationFolderPath = /Users/bmann/Dev/my-project/cypress/integration
- //# relativePathFromIntegrationFolder = foo.coffee
- //# relativePathFromProjectRoot = cypress/integration/foo.coffee
+ // filePath = /Users/bmann/Dev/my-project/cypress/integration/foo.coffee
+ // integrationFolderPath = /Users/bmann/Dev/my-project/cypress/integration
+ // relativePathFromIntegrationFolder = foo.coffee
+ // relativePathFromProjectRoot = cypress/integration/foo.coffee
const relativePathFromIntegrationFolder = (file) => {
return path.relative(integrationFolderPath, file)
@@ -95,7 +85,7 @@ const find = function findSpecs (config, specPattern) {
return path.relative(config.projectRoot, file)
}
- const setNameParts = function (file) {
+ const setNameParts = (file) => {
debug('found spec file %s', file)
if (!path.isAbsolute(file)) {
@@ -111,20 +101,19 @@ const find = function findSpecs (config, specPattern) {
const ignorePatterns = [].concat(config.ignoreTestFiles)
- //# a function which returns true if the file does NOT match
- //# all of our ignored patterns
- const doesNotMatchAllIgnoredPatterns = (file) =>
- //# using {dot: true} here so that folders with a '.' in them are matched
- //# as regular characters without needing an '.' in the
- //# using {matchBase: true} here so that patterns without a globstar **
- //# match against the basename of the file
- {
+ // a function which returns true if the file does NOT match
+ // all of our ignored patterns
+ const doesNotMatchAllIgnoredPatterns = (file) => {
+ // using {dot: true} here so that folders with a '.' in them are matched
+ // as regular characters without needing an '.' in the
+ // using {matchBase: true} here so that patterns without a globstar **
+ // match against the basename of the file
return _.every(ignorePatterns, (pattern) => {
return !minimatch(file, pattern, MINIMATCH_OPTIONS)
})
}
- const matchesSpecPattern = function (file) {
+ const matchesSpecPattern = (file) => {
if (!specPattern) {
return true
}
@@ -133,8 +122,8 @@ const find = function findSpecs (config, specPattern) {
return minimatch(file, pattern, MINIMATCH_OPTIONS)
}
- //# check to see if the file matches
- //# any of the spec patterns array
+ // check to see if the file matches
+ // any of the spec patterns array
return _
.chain([])
.concat(specPattern)
diff --git a/packages/server/lib/util/status_code.js b/packages/server/lib/util/status_code.js
index cb9f9e3242..b4ffbe780b 100644
--- a/packages/server/lib/util/status_code.js
+++ b/packages/server/lib/util/status_code.js
@@ -1,10 +1,3 @@
-// TODO: This file was created by bulk-decaffeinate.
-// Sanity-check the conversion and remove this comment.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const statuses = require('http-status-codes')
const isOkStatusCodeRe = /^[2|3]\d+$/
@@ -14,7 +7,7 @@ module.exports = {
return code && isOkStatusCodeRe.test(code)
},
- //# TODO: test this method
+ // TODO: test this method
getText (code) {
try {
return statuses.getStatusText(code)
diff --git a/packages/server/lib/util/stream_buffer.ts b/packages/server/lib/util/stream_buffer.ts
index 528bb54427..6fa58ec022 100644
--- a/packages/server/lib/util/stream_buffer.ts
+++ b/packages/server/lib/util/stream_buffer.ts
@@ -63,7 +63,7 @@ function streamBuffer (initialSize = 2048) {
let bytesRead = 0
const readerId = _.uniqueId('reader')
- const onRead = function (size) {
+ const onRead = (size) => {
if (!buffer) {
debug('read requested after unpipeAll, ignoring %o', { size })
diff --git a/packages/server/lib/util/system.js b/packages/server/lib/util/system.js
index 4e6f0bcce3..d7016d79d3 100644
--- a/packages/server/lib/util/system.js
+++ b/packages/server/lib/util/system.js
@@ -1,13 +1,3 @@
-/* eslint-disable
- no-unused-vars,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const os = require('os')
const Promise = require('bluebird')
const getos = Promise.promisify(require('getos'))
@@ -18,7 +8,7 @@ const getOsVersion = () => {
return getos()
.then((obj) => {
return [obj.dist, obj.release].join(' - ')
- }).catch((err) => {
+ }).catch(() => {
return os.release()
})
}
diff --git a/packages/server/lib/util/terminal.js b/packages/server/lib/util/terminal.js
index 0d97c24323..626d6a16c0 100644
--- a/packages/server/lib/util/terminal.js
+++ b/packages/server/lib/util/terminal.js
@@ -1,4 +1,3 @@
-/* eslint-disable no-console */
const _ = require('lodash')
const chalk = require('chalk')
const Table = require('cli-table3')
@@ -33,7 +32,7 @@ const renderTables = (...tables) => {
.value()
}
-const getChars = function (type) {
+const getChars = (type) => {
switch (type) {
case 'border':
return {
@@ -131,7 +130,7 @@ const wrapBordersInGray = (chars) => {
})
}
-const table = function (options = {}) {
+const table = (options = {}) => {
const { type } = options
const defaults = utils.mergeOptions({})
@@ -146,9 +145,9 @@ const table = function (options = {}) {
'padding-left': 1,
'padding-right': 1,
},
- });
+ })
- ({ chars } = options)
+ chars = options.chars
if (colWidths) {
const sum = _.sum(colWidths)
@@ -178,7 +177,7 @@ const table = function (options = {}) {
return new Table(options)
}
-const header = function (message, options = {}) {
+const header = (message, options = {}) => {
_.defaults(options, {
color: null,
})
@@ -190,18 +189,17 @@ const header = function (message, options = {}) {
message = _.reduce(colors, (memo, color) => {
return chalk[color](memo)
- }
- , message)
+ }, message)
}
- console.log(message)
+ console.log(message) // eslint-disable-line no-console
}
-const divider = function (symbol, color = 'gray') {
+const divider = (symbol, color = 'gray') => {
const cols = getMaximumColumns()
const str = symbol.repeat(cols)
- console.log(chalk[color](str))
+ console.log(chalk[color](str)) // eslint-disable-line no-console
}
module.exports = {
diff --git a/packages/server/lib/util/validation.js b/packages/server/lib/util/validation.js
index b2b53f2ce3..7eda92e285 100644
--- a/packages/server/lib/util/validation.js
+++ b/packages/server/lib/util/validation.js
@@ -1,23 +1,11 @@
-/* eslint-disable
- no-unused-vars,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * DS207: Consider shorter variations of null checks
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
const _ = require('lodash')
-const errors = require('../errors')
const debug = require('debug')('cypress:server:validation')
const is = require('check-more-types')
const { commaListsOr } = require('common-tags')
-// # validation functions take a key and a value and should:
-// # - return true if it passes validation
-// # - return a error message if it fails validation
+// validation functions take a key and a value and should:
+// - return true if it passes validation
+// - return a error message if it fails validation
const str = JSON.stringify