11const container = require ( './container' ) ;
2+ const store = require ( './store' ) ;
23const recorder = require ( './recorder' ) ;
34const event = require ( './event' ) ;
45const output = require ( './output' ) ;
@@ -29,19 +30,18 @@ const pause = function () {
2930
3031function pauseSession ( ) {
3132 recorder . session . start ( 'pause' ) ;
32- output . print ( colors . yellow ( ' Interactive shell started' ) ) ;
33- output . print ( colors . yellow ( ` Press ${ colors . bold ( 'ENTER' ) } to run the next step` ) ) ;
34- output . print ( colors . yellow ( ` Enter ${ colors . bold ( 'exit' ) } to exit the interactive shell and resume the test` ) ) ;
3533 if ( ! next ) {
36- output . print ( colors . yellow ( ' - Use JavaScript syntax to try steps in action ' ) ) ;
37- output . print ( colors . yellow ( ` - Press ${ colors . bold ( 'TAB' ) } twice to see all available commands` ) ) ;
34+ output . print ( colors . yellow ( ' Interactive shell started ' ) ) ;
35+ output . print ( colors . yellow ( ' Use JavaScript syntax to try steps in action' ) ) ;
3836 output . print ( colors . yellow ( ` - Press ${ colors . bold ( 'ENTER' ) } to run the next step` ) ) ;
37+ output . print ( colors . yellow ( ` - Press ${ colors . bold ( 'TAB' ) } twice to see all available commands` ) ) ;
38+ output . print ( colors . yellow ( ` - Type ${ colors . bold ( 'exit' ) } + Enter to exit the interactive shell` ) ) ;
3939 }
4040 rl = readline . createInterface ( process . stdin , process . stdout , completer ) ;
4141
4242 rl . on ( 'line' , parseInput ) ;
4343 rl . on ( 'close' , ( ) => {
44- console . log ( 'Exiting interactive shell....' ) ;
44+ if ( ! next ) console . log ( 'Exiting interactive shell....' ) ;
4545 } ) ;
4646 return new Promise ( ( ( resolve ) => {
4747 finish = resolve ;
@@ -52,13 +52,15 @@ function pauseSession() {
5252function parseInput ( cmd ) {
5353 rl . pause ( ) ;
5454 next = false ;
55+ store . debugMode = false ;
5556 if ( cmd === '' ) next = true ;
56- if ( ! cmd || cmd === 'resume' ) {
57+ if ( ! cmd || cmd === 'resume' || cmd === 'exit' ) {
5758 finish ( ) ;
5859 recorder . session . restore ( ) ;
5960 rl . close ( ) ;
6061 return nextStep ( ) ;
6162 }
63+ store . debugMode = true ;
6264 try {
6365 const I = container . support ( 'I' ) ;
6466 eval ( `I.${ cmd } ` ) ; // eslint-disable-line no-eval
@@ -87,7 +89,6 @@ function completer(line) {
8789 const completions = methodsOfObject ( I ) ;
8890 const hits = completions . filter ( ( c ) => {
8991 if ( c . indexOf ( line ) === 0 ) {
90- // console.log('bang! ' + c);
9192 return c ;
9293 }
9394 return null ;
0 commit comments