@@ -292,45 +292,37 @@ writeFileSync(String.raw\`${joinPath('result.txt')}\`, 'hello world');
292292 writeFileSync ( inputPath , '{}' , { flag : 'w' } ) ;
293293 copyFileSync ( missingRequiredPropertyInputSchemaPath , inputSchemaPath ) ;
294294
295- await testRunCommand ( RunCommand , { } ) ;
296-
297- expect ( lastErrorMessage ( ) ) . toMatch ( / F i e l d a w e s o m e i s r e q u i r e d / i) ;
295+ await expect ( testRunCommand ( RunCommand , { } ) ) . rejects . toThrow ( / F i e l d a w e s o m e i s r e q u i r e d / i) ;
298296 } ) ;
299297
300298 it ( 'throws when required field has wrong type' , async ( ) => {
301299 writeFileSync ( inputPath , '{"awesome": 42}' , { flag : 'w' } ) ;
302300 copyFileSync ( defaultsInputSchemaPath , inputSchemaPath ) ;
303301
304- await testRunCommand ( RunCommand , { } ) ;
305-
306- expect ( lastErrorMessage ( ) ) . toMatch ( / F i e l d a w e s o m e m u s t b e b o o l e a n / i) ;
302+ await expect ( testRunCommand ( RunCommand , { } ) ) . rejects . toThrow ( / F i e l d a w e s o m e m u s t b e b o o l e a n / i) ;
307303 } ) ;
308304
309305 it ( 'throws when passing manual input, but local file has correct input' , async ( ) => {
310306 writeFileSync ( inputPath , '{"awesome": true}' , { flag : 'w' } ) ;
311307 copyFileSync ( defaultsInputSchemaPath , inputSchemaPath ) ;
312308
313- await testRunCommand ( RunCommand , { flags_input : handPassedInput } ) ;
314-
315- expect ( lastErrorMessage ( ) ) . toMatch ( / F i e l d a w e s o m e m u s t b e b o o l e a n / i ) ;
309+ await expect ( testRunCommand ( RunCommand , { flags_input : handPassedInput } ) ) . rejects . toThrow (
310+ / F i e l d a w e s o m e m u s t b e b o o l e a n / i ,
311+ ) ;
316312 } ) ;
317313
318314 it ( 'throws when input has default field of wrong type' , async ( ) => {
319315 writeFileSync ( inputPath , '{"awesome": true, "help": 123}' , { flag : 'w' } ) ;
320316 copyFileSync ( defaultsInputSchemaPath , inputSchemaPath ) ;
321317
322- await testRunCommand ( RunCommand , { } ) ;
323-
324- expect ( lastErrorMessage ( ) ) . toMatch ( / F i e l d h e l p m u s t b e s t r i n g / i) ;
318+ await expect ( testRunCommand ( RunCommand , { } ) ) . rejects . toThrow ( / F i e l d h e l p m u s t b e s t r i n g / i) ;
325319 } ) ;
326320
327321 it ( 'throws when input has prefilled field of wrong type' , async ( ) => {
328322 writeFileSync ( inputPath , '{"awesome": true, "help": 123}' , { flag : 'w' } ) ;
329323 copyFileSync ( prefillsInputSchemaPath , inputSchemaPath ) ;
330324
331- await testRunCommand ( RunCommand , { } ) ;
332-
333- expect ( lastErrorMessage ( ) ) . toMatch ( / F i e l d h e l p m u s t b e s t r i n g / i) ;
325+ await expect ( testRunCommand ( RunCommand , { } ) ) . rejects . toThrow ( / F i e l d h e l p m u s t b e s t r i n g / i) ;
334326 } ) ;
335327
336328 it ( 'automatically inserts missing defaulted fields' , async ( ) => {
0 commit comments