Skip to content

Commit

Permalink
Do not add extra leading -- in error message for flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinika committed Dec 5, 2024
1 parent f894ed1 commit 19bd2a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cli/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const parse = (args = [], defaultValues = {}, ...configObjects) => {
expectedTypeForFlag(maybeFlag) !== 'number'
) {
throw createInvalidArgumentTypeError(
`Mocha flag '--${maybeFlag}' given invalid option: '${arg}'`,
`Mocha flag '${maybeFlag}' given invalid option: '${arg}'`,
Number(arg),
expectedTypeForFlag(maybeFlag)
);
Expand Down
2 changes: 1 addition & 1 deletion test/node-unit/cli/options.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ describe('options', function () {

const invalidArgError = (flag, arg, expectedType = 'string') => {
return {
message: `Mocha flag '--${flag}' given invalid option: '${arg}'`,
message: `Mocha flag '${flag}' given invalid option: '${arg}'`,
code: constants.INVALID_ARG_TYPE,
argument: arg,
actual: 'number',
Expand Down

0 comments on commit 19bd2a4

Please sign in to comment.