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

feat: bump yargs to 17 #5165

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const debug = require('debug')('mocha:cli:cli');
const symbols = require('log-symbols');
const yargs = require('yargs/yargs');
const yargs = require('yargs');
const path = require('path');
const {
loadRc,
Expand Down Expand Up @@ -63,15 +63,15 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
debug('caught error sometime before command handler: %O', err);
yargs.showHelp();
console.error(`\n${symbols.error} ${ansi.red('ERROR:')} ${msg}`);
process.exitCode = 1;
process.exit(1);
})
.help('help', 'Show usage information & exit')
.alias('help', 'h')
.version('version', 'Show version number & exit', version)
.alias('version', 'V')
.wrap(process.stdout.columns ? Math.min(process.stdout.columns, 80) : 80)
.epilog(
`Mocha Resources
`${ansi.reset("Mocha Resources")}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This epilog(ue) wasn't being printed before. Now it is. On error, everything is red, so this ansi.reset is needed to make the colors actually show through.

Chat: ${ansi.magenta(discord)}
GitHub: ${ansi.blue(repository.url)}
Docs: ${ansi.yellow(homepage)}
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ exports.builder = yargs =>
group: GROUPS.RULES
},
'list-interfaces': {
conflicts: Array.from(ONE_AND_DONE_ARGS),
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-interfaces"),
description: 'List built-in user interfaces & exit'
},
'list-reporters': {
conflicts: Array.from(ONE_AND_DONE_ARGS),
conflicts: Array.from(ONE_AND_DONE_ARGS).filter(arg => arg !== "list-reporters"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without these:

  2 failing
  1) --list-interfaces
       should dump a list of all interfaces with descriptions:
     Uncaught UnexpectedError: 
expected 1 to be 0
      at /home/runner/work/mocha/mocha/test/integration/options/listInterfaces.spec.js:26:7
      at ChildProcess.<anonymous> (test/integration/helpers.js:352:5)
      at ChildProcess.emit (node:events:519:28)
      at maybeClose (node:internal/child_process:1105:16)
      at ChildProcess._handle.onexit (node:internal/child_process:305:5)
      set UNEXPECTED_FULL_TRACE=true to see the full stack trace
  2) --list-reporters
       should dump a list of all reporters with descriptions:
     Uncaught UnexpectedError: 
expected 1 to be 0
      at /home/runner/work/mocha/mocha/test/integration/options/listReporters.spec.js:29:7
      at ChildProcess.<anonymous> (test/integration/helpers.js:352:5)
      at ChildProcess.emit (node:events:519:28)
      at maybeClose (node:internal/child_process:1105:16)
      at ChildProcess._handle.onexit (node:internal/child_process:305:5)
      set UNEXPECTED_FULL_TRACE=true to see the full stack trace

description: 'List built-in reporters & exit'
},
'no-colors': {
Expand Down
4 changes: 3 additions & 1 deletion lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ function Mocha(options = {}) {
.ui(options.ui)
.reporter(
options.reporter,
options.reporterOption || options.reporterOptions // for backwards compatibility
options['reporter-option'] ||
options.reporterOption ||
options.reporterOptions // for backwards compatibility
)
.slow(options.slow)
.global(options.global);
Expand Down
Loading
Loading