Files
cypress/cli/index.js
T
Gleb Bahmutov 8e1776c870 Issue 146: uniform CLI error reporting (#149)
* cli: shorter install message without undefined for #146

* cli: show relative path after install

* cli: debug install process

* cli: print message if using CYPRESS_VERSION

* cli: tests for CYPRESS_VERSION install

* cli: needed version message

* cli: verify app after download on install

* cli: do not verify app on install, wait until it runs

* cli: add verify command

* cli: good messags for missing app binary

* cli: xvfb error

* add missing app error

* linting

* cli: errors reported using same function

* print stack in error message for some errors

* show path checked

* use same error mechanism for download errors

* cli: unzip should report error the same way as the rest of CLI

* update some error language

* consolidate urls in error messages

* show terminal info

* terminal check outside of code

* cli: detect CI, do not use progress bar

* cli: test mock bar

* remove context.only
2017-06-09 17:37:48 -04:00

38 lines
1.1 KiB
JavaScript

const minimist = require('minimist')
const debug = require('debug')('cypress:cli')
const args = minimist(process.argv.slice(2))
function installingFromNpmAsAUser () {
// when installing from monorepo we explicitly
// opt out of downloading. if we aren't running
// from the root monorepo, then go ahead and
// download and install cypress binary
return process.env.CYPRESS_DOWNLOAD !== "0"
}
// we're being used from the command line
switch (args.exec) {
case 'install':
// only go out and download the cypress
// binary if we're consuming this as an
// npm package
if (installingFromNpmAsAUser()) {
debug('installing Cypress from NPM')
require('./lib/download')
.install()
.catch(console.error) // eslint-disable-line no-console
}
break
case 'verify':
// for simple testing in the monorepo
debug('verifying Cypress')
require('./lib/download/utils')
.verify()
.catch(console.error) // eslint-disable-line no-console
break
default:
// export our node module interface
module.exports = require("./lib/cypress")
}