Skip to content

Commit

Permalink
Revert timeout and slow as string flags so that they can accept human…
Browse files Browse the repository at this point in the history
… readable values
  • Loading branch information
Dinika committed Dec 5, 2024
1 parent 912bdd1 commit 86e973e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/cli/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const createErrorForNumericPositionalArg = (
return (
isMochaFlag(arg) &&
allArgs[index + 1] === String(numericArg) &&
parsedResult[normalizedArg] !== numericArg
parsedResult[normalizedArg] !== String(numericArg)
);
});

Expand Down Expand Up @@ -157,7 +157,7 @@ const parse = (args = [], defaultValues = {}, ...configObjects) => {
// are ALL boolean flags.
// 4. we can then reapply the values after yargs-parser is done.
const allArgs = Array.isArray(args) ? args : args.split(' ');
const nodeArgs = allArgs.reduce((acc, arg, index, allArgs) => {
const nodeArgs = allArgs.reduce((acc, arg) => {
const pair = arg.split('=');
let flag = pair[0];
if (isNodeFlag(flag, false)) {
Expand Down
13 changes: 11 additions & 2 deletions lib/cli/run-option-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ const TYPES = (exports.types = {
'sort',
'watch'
],
number: ['retries', 'jobs', 'slow', 'timeout'],
string: ['config', 'fgrep', 'grep', 'package', 'reporter', 'ui']
number: ['retries', 'jobs'],
string: [
'config',
'fgrep',
'grep',
'package',
'reporter',
'ui',
'slow',
'timeout'
]
});

/**
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 @@ -527,7 +527,7 @@ describe('options', function () {
loadOptions('--timeout 500'),
'to have property',
'timeout',
500
'500'
);
});

Expand Down

0 comments on commit 86e973e

Please sign in to comment.