Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes failure output in mocha init w/o target #4359

Merged
merged 1 commit into from
Jul 7, 2020

Conversation

boneskull
Copy link
Contributor

yargs.exit() is not always present, apparently. it will throw in this case--we don't need to be calling it anyway.

before this change, you see the following when running mocha init w/o the <path>

mocha init <path>

create a client-side Mocha setup at <path>

Positional Arguments
  path                                                       [string] [required]

Other Options
  --help, -h     Show usage information & exit                         [boolean]
  --version, -V  Show version number & exit                            [boolean]

✖ ERROR: Not enough non-option arguments: got 0, need at least 1
/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/yargs.js:1172
      else throw err
           ^

TypeError: yargs.exit is not a function
    at Array.<anonymous> (/Users/boneskull/projects/mochajs/mocha/lib/cli/cli.js:55:13)
    at Object.fail (/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/lib/usage.js:41:17)
    at Object.positionalCount (/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/lib/validation.js:51:13)
    at populatePositionals (/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/lib/command.js:301:16)
    at Object.runCommand (/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/lib/command.js:225:23)
    at Object.parseArgs [as _parseArgs] (/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/yargs.js:1087:30)
    at Object.parse (/Users/boneskull/projects/mochajs/mocha/node_modules/yargs/yargs.js:575:25)
    at Object.exports.main (/Users/boneskull/projects/mochajs/mocha/lib/cli/cli.js:71:6)
    at Object.<anonymous> (/Users/boneskull/projects/mochajs/mocha/bin/mocha:153:29)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

`yargs.exit()` is not always present, apparently. it will throw in this case--we don't need to be calling it anyway.
@boneskull boneskull added type: bug a defect, confirmed by a maintainer semver-patch implementation requires increase of "patch" version number; "bug fixes" labels Jul 1, 2020
@boneskull boneskull self-assigned this Jul 1, 2020
@boneskull
Copy link
Contributor Author

just gonna merge this, probably not a huge deal.

@boneskull boneskull merged commit 7c8896c into master Jul 7, 2020
@boneskull boneskull deleted the boneskull/fix-init-failure branch July 7, 2020 19:30
@boneskull boneskull added this to the next milestone Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch implementation requires increase of "patch" version number; "bug fixes" type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant