web-ext icon indicating copy to clipboard operation
web-ext copied to clipboard

Consider to remove check for undefined runCommand got after parsing cli arguments in Program.prototype.execute or to add explicit coverage for an

Open rpl opened this issue 3 years ago • 0 comments

After merging #2235 the following UsageError is never hit in tests:

  • https://github.com/mozilla/web-ext/blob/2c1e09cca2ab4b2a719c61054a184dcaec7d366e/src/program.js#L277-L279
  • https://app.codecov.io/gh/mozilla/web-ext/compare/2235/diff

The last release of yargs v17 is being more strict about command unknown based on the yargs command lists as defined in src/program.js and so that is now covered by an additional check added to Program.prototype.getArguments (which throws an UsageError from the "Unknown argument: ..." YError being now raised by yargs).

It is likely that we can't hit that error on runCommand being undefined anymore unless a command is defined from a yargs perspective but there isn't a related source module exported from src/cmd, which would be something that unit tests should cover and so may not be necessary as a real runtime error condition.

This issue is tracking the additional changes needed to followup to #2235 changes by either removing the additional check or to cover it explicitly in tests.

rpl avatar Jun 07 '22 14:06 rpl