File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,14 @@ async function run(config) {
38
38
console . log ( `STAC Node Validator v${ version } \n` ) ;
39
39
}
40
40
41
+ // Show minimal help output
42
+ if ( args . help ) {
43
+ console . log ( "For more information on using this command line tool, please visit" ) ;
44
+ console . log ( "https://github.com/stac-utils/stac-node-validator/blob/master/README.md#usage" ) ;
45
+
46
+ process . exit ( 0 ) ;
47
+ }
48
+
41
49
// Read config from file
42
50
if ( typeof args . config === 'string' ) {
43
51
let configFile ;
Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ it('Should print version number', async () => {
33
33
expect ( mockExit ) . toHaveBeenCalledWith ( 0 ) ;
34
34
} ) ;
35
35
36
+ it ( 'Should print help' , async ( ) => {
37
+ await app ( { help : true } ) ;
38
+
39
+ expect ( consoleLogSpy . mock . calls [ 0 ] [ 0 ] ) . toContain ( initString ) ;
40
+ expect ( consoleLogSpy . mock . calls [ 1 ] [ 0 ] ) . toContain ( "For more information on using this command line tool, please visit" ) ;
41
+ expect ( consoleLogSpy . mock . calls [ 2 ] [ 0 ] ) . toContain ( "https://github.com/stac-utils/stac-node-validator/blob/master/README.md#usage" ) ;
42
+ expect ( mockExit ) . toHaveBeenCalledWith ( 0 ) ;
43
+ } ) ;
44
+
36
45
describe ( 'Running without parameters or configuration' , ( ) => {
37
46
it ( 'Should return exit code 1' , async ( ) => {
38
47
await app ( ) ;
You can’t perform that action at this time.
0 commit comments