@@ -200,6 +200,8 @@ describe('Validate cli', () => {
200
200
${ 'reporter' } | ${ [ '-r' , pathFix ( 'features/reporter' ) , '-c' , pathFix ( 'features/reporter/cspell.config.yaml' ) ] } | ${ undefined } | ${ false } | ${ true } | ${ false }
201
201
${ 'issue-4811 **/README.md' } | ${ [ '-r' , pIssues ( 'issue-4811' ) , '--no-progress' , '**/README.md' ] } | ${ undefined } | ${ true } | ${ false } | ${ false }
202
202
${ 'issue-4811' } | ${ [ '-r' , pIssues ( 'issue-4811' ) , '--no-progress' , '.' ] } | ${ app . CheckFailed } | ${ true } | ${ true } | ${ false }
203
+ ${ 'issue-6373 .' } | ${ [ '-r' , pathFix ( 'issue-6373' ) , '--no-progress' , '.' ] } | ${ app . CheckFailed } | ${ true } | ${ true } | ${ false }
204
+ ${ 'issue-6373' } | ${ [ '-r' , pathFix ( 'issue-6373' ) , '--no-progress' ] } | ${ undefined } | ${ true } | ${ false } | ${ false }
203
205
${ 'verify globRoot works' } | ${ [ '-r' , pathFix ( 'globRoot' ) , '.' ] } | ${ undefined } | ${ true } | ${ false } | ${ false }
204
206
` ( 'app $msg Expect Error: $errorCheck' , async ( { testArgs, errorCheck, eError, eLog, eInfo } : TestCase ) => {
205
207
chalk . level = 1 ;
@@ -226,8 +228,8 @@ describe('Validate cli', () => {
226
228
chalk . level = 1 ;
227
229
const commander = getCommander ( ) ;
228
230
const args = argv ( ...testArgs ) ;
229
- const result = app . run ( commander , args ) ;
230
- await ( ! errorCheck ? expect ( result ) . resolves . toBeUndefined ( ) : expect ( result ) . rejects . toThrow ( errorCheck ) ) ;
231
+ const result = await asyncResult ( app . run ( commander , args ) ) ;
232
+ expect ( result ) . toEqual ( errorCheck ) ;
231
233
232
234
eError ? expect ( error ) . toHaveBeenCalled ( ) : expect ( error ) . not . toHaveBeenCalled ( ) ;
233
235
@@ -426,3 +428,11 @@ function makeLogger() {
426
428
function escapeRegExp ( s : string ) : string {
427
429
return s . replaceAll ( / [ $ ( ) * + . ? [ \\ \] ^ { | } ] / g, '\\$&' ) . replaceAll ( '-' , '\\x2d' ) ;
428
430
}
431
+
432
+ async function asyncResult < T > ( p : Promise < T > ) : Promise < T | Error > {
433
+ try {
434
+ return await p ;
435
+ } catch ( e ) {
436
+ return e as Error ;
437
+ }
438
+ }
0 commit comments