This repository was archived by the owner on Feb 1, 2022. It is now read-only.
File tree 3 files changed +28
-16
lines changed
3 files changed +28
-16
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,13 @@ class NodeInspector {
123
123
const attemptConnect = ( ) => {
124
124
++ connectionAttempts ;
125
125
this . stdout . write ( '.' ) ;
126
- this . client . connect ( )
127
- . then ( null , ( ) => {
126
+ return this . client . connect ( )
127
+ . then ( ( ) => {
128
+ this . stdout . write ( ' done' ) ;
129
+ } , ( ) => {
128
130
// If it's failed to connect 10 times then print failed message
129
131
if ( connectionAttempts >= 10 ) {
130
- this . print ( ' failed to connect, please retry' ) ;
132
+ this . stdout . write ( ' failed to connect, please retry\n ' ) ;
131
133
process . exit ( 1 ) ;
132
134
}
133
135
return delay ( 500 ) . then ( ( ) => attemptConnect ( ) ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const tap = require ( 'tap' ) ;
3
+
4
+ const startCLI = require ( './start-cli' ) ;
5
+
6
+ tap . test ( 'launch CLI w/o args' , ( t ) => {
7
+ const cli = startCLI ( [ ] ) ;
8
+ return cli . quit ( )
9
+ . then ( ( code ) => {
10
+ t . equal ( code , 1 , 'exits with non-zero exit code' ) ;
11
+ t . match ( cli . output , / ^ U s a g e : / , 'Prints usage info' ) ;
12
+ } ) ;
13
+ } ) ;
14
+
15
+ tap . test ( 'launch w/ invalid host:port' , ( t ) => {
16
+ const cli = startCLI ( [ 'localhost:914' ] ) ;
17
+ return cli . quit ( )
18
+ . then ( ( code ) => {
19
+ t . match ( cli . output , 'failed to connect' ,
20
+ 'Tells the user that the connection failed' ) ;
21
+ t . equal ( code , 1 , 'exits with non-zero exit code' ) ;
22
+ } ) ;
23
+ } ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments