File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -272,5 +272,6 @@ program.on('command:*', (cmd) => {
272
272
273
273
if ( process . argv . length <= 2 ) {
274
274
program . outputHelp ( ) ;
275
+ } else {
276
+ program . parse ( process . argv ) ;
275
277
}
276
- program . parse ( process . argv ) ;
Original file line number Diff line number Diff line change
1
+ const assert = require ( 'assert' ) ;
2
+ const path = require ( 'path' ) ;
3
+ const exec = require ( 'child_process' ) . exec ;
4
+
5
+ const runner = path . join ( __dirname , '/../../bin/codecept.js' ) ;
6
+
7
+ describe ( 'help option' , ( ) => {
8
+ it ( 'should print help message with --help option' , ( done ) => {
9
+ exec ( `${ runner } --help` , ( err , stdout ) => {
10
+ stdout . should . include ( 'Usage:' ) ;
11
+ stdout . should . include ( 'Options:' ) ;
12
+ stdout . should . include ( 'Commands:' ) ;
13
+ assert ( ! err ) ;
14
+ done ( ) ;
15
+ } ) ;
16
+ } ) ;
17
+
18
+ it ( 'should print help message with -h option' , ( done ) => {
19
+ exec ( `${ runner } -h` , ( err , stdout ) => {
20
+ stdout . should . include ( 'Usage:' ) ;
21
+ stdout . should . include ( 'Options:' ) ;
22
+ stdout . should . include ( 'Commands:' ) ;
23
+ assert ( ! err ) ;
24
+ done ( ) ;
25
+ } ) ;
26
+ } ) ;
27
+
28
+ it ( 'should print help message with no option' , ( done ) => {
29
+ exec ( `${ runner } ` , ( err , stdout ) => {
30
+ stdout . should . include ( 'Usage:' ) ;
31
+ stdout . should . include ( 'Options:' ) ;
32
+ stdout . should . include ( 'Commands:' ) ;
33
+ assert ( ! err ) ;
34
+ done ( ) ;
35
+ } ) ;
36
+ } ) ;
37
+ } ) ;
You can’t perform that action at this time.
0 commit comments