You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: error handling for unexpected numeric arguments passed to cli (#5263)
* Fix 5028 // Numerical arguments to cli throw uncaught error
This PR throws a custom error which is (hopefully) easier to understand
when:
i. a numerical argument is passed to mocha cli
ii. numerical value is used as a value for one of the mocha flags that is not compatible with
numerical values.
Signed-off-by: Dinika Saxena <[email protected]>
* Use type-check to throw error instead of a broad try/catch
Signed-off-by: Dinika Saxena <[email protected]>
* Rename numerical to numeric
Signed-off-by: Dinika Saxena <[email protected]>
* Find flag for mocha cli after parsing yargs
* Find flag for faulty numeric args before yargs parser
Signed-off-by: Dinika Saxena <[email protected]>
* Add js-doc private keyword to fix netlify doc deployment
* [Style] // Reduce code duplication
* Add an "it" block for each flag for easier debug-ability
Signed-off-by: Dinika Saxena <[email protected]>
* Remove ? from flag since it cannot be undefined
* Add test cases for empty string checks for isNumeric
* Do not add extra leading -- in error message for flag
* Throw error for numeric positional arg after yargs-parser has parsed args
Signed-off-by: Dinika Saxena <[email protected]>
* Revert timeout and slow as string flags so that they can accept human readable values
Signed-off-by: Dinika Saxena <[email protected]>
---------
Signed-off-by: Dinika Saxena <[email protected]>
Signed-off-by: Dinika Saxena <[email protected]>
* Returns expected yarg option type for a given mocha flag.
120
+
* @param {string} flag - Flag to check (can be with or without leading dashes "--"")
121
+
* @returns {string | undefined} - If flag is a valid mocha flag, the expected type of argument for this flag is returned, otherwise undefined is returned.
0 commit comments