@@ -82,11 +82,12 @@ var resolveHelp = [
8282 '' ,
8383 ' Options:' ,
8484 '' ,
85- ' -h, --help output usage information' ,
86- ' -f, --force Do not fail when the document has invalid JSON References' ,
87- ' -H, --header <header> The header to use when retrieving a remote document' ,
88- ' -I, --filter <type> The type of JSON References to resolved' ,
89- ' -y, --yaml Output as YAML' ,
85+ ' -h, --help output usage information' ,
86+ ' -f, --force Do not fail when the document has invalid JSON References' ,
87+ ' -H, --header <header> The header to use when retrieving a remote document' ,
88+ ' -I, --filter <type> The type of JSON References to resolved' ,
89+ ' -w, --warnings-as-errors Treat warnings as errors' ,
90+ ' -y, --yaml Output as YAML' ,
9091 '' ,
9192 ''
9293] . join ( '\n' ) ;
@@ -355,6 +356,30 @@ describe('json-refs CLI', function () {
355356 } ) ;
356357 } ) ;
357358
359+ it ( '--warnings-as-errors option' , function ( done ) {
360+ this . timeout ( 10000 ) ;
361+
362+ executeJsonRefs ( [ 'resolve' , testDocumentLocation , '--warnings-as-errors' ] , function ( stderr , stdout ) {
363+ assert . equal ( stdout , '' ) ;
364+
365+ assert . equal ( stderr , [
366+ '' ,
367+ ' error: Document has invalid references:' ,
368+ '' ,
369+ ' #/missing: JSON Pointer points to missing location: #/some/missing/path' ,
370+ ' #/warning: Extra JSON Reference properties will be ignored: ignored' ,
371+ ' #/invalid: HTTP URIs must have a host.' ,
372+ ' #/remote/relative/missing: JSON Pointer points to missing location: #/some/missing/path' ,
373+ ' #/remote/relative/child/missing: JSON Pointer points to missing location: #/some/missing/path' ,
374+ ' #/remote/relative/child/ancestor/missing: JSON Pointer points to missing location: #/some/missing/path' ,
375+ '' ,
376+ ''
377+ ] . join ( '\n' ) ) ;
378+
379+ done ( ) ;
380+ } ) ;
381+ } ) ;
382+
358383 it ( '--yaml option' , function ( done ) {
359384 this . timeout ( 10000 ) ;
360385
0 commit comments