Improve handling of oclif parser errors.

Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
Scott Lowe 2020-06-23 12:09:12 +02:00
parent 7d2e32777f
commit 5b5f258685
2 changed files with 8 additions and 4 deletions

View File

@ -137,9 +137,11 @@ const EXPECTED_ERROR_REGEXES = [
/^BalenaDeviceNotFound/, // balena-sdk
/^BalenaExpiredToken/, // balena-sdk
/^Missing \w+$/, // Capitano,
/^Missing \d+ required arg/, // oclif parser: RequiredArgsError, RequiredFlagError
/^Missing \d+ required arg/, // oclif parser: RequiredArgsError
/Missing required flag/, // oclif parser: RequiredFlagError
/^Unexpected argument/, // oclif parser: UnexpectedArgsError
/to be one of/, // oclif parser: FlagInvalidOptionError, ArgInvalidOptionError
/must also be provided when using/, // oclif parser (depends-on)
];
// Support unit testing of handleError

View File

@ -120,9 +120,11 @@ describe('handleError() function', () => {
'Missing uuid', // Capitano
'Missing 1 required argument', // oclif
'Missing 2 required arguments', // oclif
'Unexpected argument',
'Unexpected arguments',
'to be one of',
'Missing required flag', // oclif
'Unexpected argument', // oclif
'Unexpected arguments', // oclif
'to be one of', // oclif
'must also be provided when using', // oclif
];
messagesToMatch.forEach((message) => {