mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-07 15:09:48 -06:00
* WIP: add cli info command to list detected browsers * print found browsers * change to list * start work on info command calling into binary * move info command into binary * print OS info during cypress info command * add binary cache path to info command * add browser profile path * add memory * get browser profile path without partition * pick real browsers as examples * output same info as desired * better names * changed colors * add list of cached binary versions * do not put stable into name * add underlined link * conditionally show profile path, only if the folder exists * do not list cached binaries * human-friendly memory print * print env proxy vars * print CYPRESS_ env variables * use _.sample * update order * store cypress info output on CI as HTML page artifact * add percy CLI screenshots * sanitize cypress info command * store CLI snapshots in cli/visual-snapshots folder * update cli unit snapshot * add cli unit test * start e2e testing for cypress info * add test with proxy and cypress vars * make sure we call the binary * stricter start check * start unit testing modes info * test info mode browser print * add test for profile path * add cypress info command to test binary Circle job * add cypress info to test-binary-as-specific-user circle * print cypress info --dev on circle and on appveyor * update .gitignore * move error in environment load to debug
94 lines
2.5 KiB
JavaScript
94 lines
2.5 KiB
JavaScript
/* eslint-disable no-console */
|
|
const spawn = require('./spawn')
|
|
const util = require('../util')
|
|
const state = require('../tasks/state')
|
|
const os = require('os')
|
|
const chalk = require('chalk')
|
|
const prettyBytes = require('pretty-bytes')
|
|
const _ = require('lodash')
|
|
const R = require('ramda')
|
|
|
|
// color for numbers and show values
|
|
const g = chalk.green
|
|
// color for paths
|
|
const p = chalk.cyan
|
|
// urls
|
|
const link = chalk.blue.underline
|
|
|
|
// to be exported
|
|
const methods = {}
|
|
|
|
methods.findProxyEnvironmentVariables = () => {
|
|
return _.pick(process.env, ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY'])
|
|
}
|
|
|
|
const maskSensitiveVariables = R.evolve({
|
|
CYPRESS_RECORD_KEY: R.always('<redacted>'),
|
|
})
|
|
|
|
methods.findCypressEnvironmentVariables = () => {
|
|
const isCyVariable = (val, key) => key.startsWith('CYPRESS_')
|
|
|
|
return R.pickBy(isCyVariable)(process.env)
|
|
}
|
|
|
|
const formatCypressVariables = () => {
|
|
const vars = methods.findCypressEnvironmentVariables()
|
|
|
|
return maskSensitiveVariables(vars)
|
|
}
|
|
|
|
methods.start = (options = {}) => {
|
|
const args = ['--mode=info']
|
|
|
|
return spawn.start(args, {
|
|
dev: options.dev,
|
|
})
|
|
.then(() => {
|
|
console.log()
|
|
const proxyVars = methods.findProxyEnvironmentVariables()
|
|
|
|
if (_.isEmpty(proxyVars)) {
|
|
console.log('Proxy Settings: none detected')
|
|
} else {
|
|
console.log('Proxy Settings:')
|
|
_.forEach(proxyVars, (value, key) => {
|
|
console.log('%s: %s', key, g(value))
|
|
})
|
|
|
|
console.log()
|
|
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'))
|
|
console.log()
|
|
}
|
|
})
|
|
.then(() => {
|
|
const cyVars = formatCypressVariables()
|
|
|
|
if (_.isEmpty(cyVars)) {
|
|
console.log('Environment Variables: none detected')
|
|
} else {
|
|
console.log('Environment Variables:')
|
|
_.forEach(cyVars, (value, key) => {
|
|
console.log('%s: %s', key, g(value))
|
|
})
|
|
}
|
|
})
|
|
.then(() => {
|
|
console.log()
|
|
console.log('Application Data:', p(util.getApplicationDataFolder()))
|
|
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')))
|
|
console.log('Binary Caches: %s', p(state.getCacheDir()))
|
|
})
|
|
.then(() => {
|
|
console.log()
|
|
|
|
return util.getOsVersionAsync().then((osVersion) => {
|
|
console.log('Cypress Version: %s', g(util.pkgVersion()))
|
|
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion))
|
|
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())))
|
|
})
|
|
})
|
|
}
|
|
|
|
module.exports = methods
|