Skip to content

Commit

Permalink
Show suggestion only when unrecognized cli param length is greater th…
Browse files Browse the repository at this point in the history
…an 1
  • Loading branch information
jcs98 committed Oct 7, 2020
1 parent 5da90b5 commit 72585a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/jest-validate/src/validateCLIOptions.ts
Expand Up @@ -31,10 +31,10 @@ const createCLIValidationError = (

if (unrecognizedOptions.length === 1) {
const unrecognized = unrecognizedOptions[0];
const didYouMeanMessage = createDidYouMeanMessage(
unrecognized,
Array.from(allowedOptions),
);
const didYouMeanMessage =
unrecognized.length > 1
? createDidYouMeanMessage(unrecognized, Array.from(allowedOptions))
: '';
message =
` Unrecognized option ${chalk.bold(format(unrecognized))}.` +
(didYouMeanMessage ? ` ${didYouMeanMessage}` : '');
Expand Down

0 comments on commit 72585a4

Please sign in to comment.