Skip to content

Commit

Permalink
Revert "Merge remote-tracking branch 'origin/develop' into issue-97-f…
Browse files Browse the repository at this point in the history
…ocus-assertion"

This reverts commit b401c32, reversing
changes made to ab14758.
  • Loading branch information
kuceb committed Jan 31, 2019
1 parent 7467dc3 commit 7964c4f
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 243 deletions.
11 changes: 0 additions & 11 deletions cli/__snapshots__/cache_spec.js

This file was deleted.

96 changes: 0 additions & 96 deletions cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,99 +255,3 @@ exports['cli -v no binary version 1'] = `
Cypress package version: 1.2.3
Cypress binary version: not installed
`

exports['cli unknown option shows help for cache command - unknown option --foo 1'] = `
command: bin/cypress cache --foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
error: unknown option: --foo
Usage: cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
-h, --help output usage information
-------
stderr:
-------
-------
`

exports['cli unknown option shows help for cache command - unknown sub-command foo 1'] = `
command: bin/cypress cache foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
error: unknown command: cache foo
Usage: cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
-h, --help output usage information
-------
stderr:
-------
-------
`

exports['cli unknown option shows help for cache command - no sub-command 1'] = `
command: bin/cypress cache
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
Usage: cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
-h, --help output usage information
-------
stderr:
-------
-------
`
16 changes: 6 additions & 10 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ function unknownOption (flag, type = 'option') {
logger.error(` error: unknown ${type}:`, flag)
logger.error()
this.outputHelp()
util.exit(1)
logger.error()
process.exit(1)
}
commander.Command.prototype.unknownOption = unknownOption

Expand Down Expand Up @@ -61,9 +62,9 @@ const descriptions = {
dev: 'runs cypress in development and bypasses binary check',
forceInstall: 'force install the Cypress binary',
exit: 'keep the browser open after tests finish',
cachePath: 'print the path to the binary cache',
cacheList: 'list cached binary versions',
cacheClear: 'delete all cached binaries',
cachePath: 'print the cypress binary cache path',
cacheList: 'list the currently cached versions',
cacheClear: 'delete the Cypress binary cache',
group: 'a named group for recorded runs in the Cypress dashboard',
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
ciBuildId: 'the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers',
Expand Down Expand Up @@ -202,13 +203,8 @@ module.exports = {
.option('path', text('cachePath'))
.option('clear', text('cacheClear'))
.action(function (opts) {
if (!_.isString(opts)) {
this.outputHelp()
util.exit(1)
}

if (opts.command || !_.includes(['list', 'path', 'clear'], opts)) {
unknownOption.call(this, `cache ${opts}`, 'command')
unknownOption.call(this, `cache ${opts}`, 'sub-command')
}

cache[opts]()
Expand Down
Loading

0 comments on commit 7964c4f

Please sign in to comment.