@@ -20,52 +20,45 @@ const path = require('path');
20
20
throw error ;
21
21
}
22
22
23
- cli . waitForInitialBreak ( )
24
- . then ( ( ) => cli . waitForPrompt ( ) )
25
- . then ( ( ) => {
23
+ ( async ( ) => {
24
+ try {
25
+ await cli . waitForInitialBreak ( ) ;
26
+ await cli . waitForPrompt ( ) ;
27
+ await cli . waitForPrompt ( ) ;
26
28
assert . deepStrictEqual ( cli . breakInfo , { filename : script , line : 1 } ) ;
27
- } )
28
- // Making sure it will die by default:
29
- . then ( ( ) => cli . command ( 'c' ) )
30
- . then ( ( ) => cli . waitFor ( / d i s c o n n e c t / ) )
31
29
32
- // Next run: With `breakOnException` it pauses in both places.
33
- . then ( ( ) => cli . stepCommand ( 'r' ) )
34
- . then ( ( ) => cli . waitForInitialBreak ( ) )
35
- . then ( ( ) => {
30
+ // Making sure it will die by default:
31
+ await cli . command ( 'c' ) ;
32
+ await cli . waitFor ( / d i s c o n n e c t / ) ;
33
+
34
+ // Next run: With `breakOnException` it pauses in both places.
35
+ await cli . stepCommand ( 'r' ) ;
36
+ await cli . waitForInitialBreak ( ) ;
36
37
assert . deepStrictEqual ( cli . breakInfo , { filename : script , line : 1 } ) ;
37
- } )
38
- . then ( ( ) => cli . command ( 'breakOnException' ) )
39
- . then ( ( ) => cli . stepCommand ( 'c' ) )
40
- . then ( ( ) => {
38
+ await cli . command ( 'breakOnException' ) ;
39
+ await cli . stepCommand ( 'c' ) ;
41
40
assert . ok ( cli . output . includes ( `exception in ${ script } :3` ) ) ;
42
- } )
43
- . then ( ( ) => cli . stepCommand ( 'c' ) )
44
- . then ( ( ) => {
41
+ await cli . stepCommand ( 'c' ) ;
45
42
assert . ok ( cli . output . includes ( `exception in ${ script } :9` ) ) ;
46
- } )
47
43
48
- // Next run: With `breakOnUncaught` it only pauses on the 2nd exception.
49
- . then ( ( ) => cli . command ( 'breakOnUncaught' ) )
50
- . then ( ( ) => cli . stepCommand ( 'r' ) ) // Also, the setting survives the restart.
51
- . then ( ( ) => cli . waitForInitialBreak ( ) )
52
- . then ( ( ) => {
44
+ // Next run: With `breakOnUncaught` it only pauses on the 2nd exception.
45
+ await cli . command ( 'breakOnUncaught' ) ;
46
+ await cli . stepCommand ( 'r' ) ; // Also, the setting survives the restart.
47
+ await cli . waitForInitialBreak ( ) ;
48
+ await cli . waitForInitialBreak ( ) ;
53
49
assert . deepStrictEqual ( cli . breakInfo , { filename : script , line : 1 } ) ;
54
- } )
55
- . then ( ( ) => cli . stepCommand ( 'c' ) )
56
- . then ( ( ) => {
50
+ await cli . stepCommand ( 'c' ) ;
57
51
assert . ok ( cli . output . includes ( `exception in ${ script } :9` ) ) ;
58
- } )
59
52
60
- // Next run: Back to the initial state! It should die again.
61
- . then ( ( ) => cli . command ( 'breakOnNone' ) )
62
- . then ( ( ) => cli . stepCommand ( 'r' ) )
63
- . then ( ( ) => cli . waitForInitialBreak ( ) )
64
- . then ( ( ) => {
53
+ // Next run: Back to the initial state! It should die again.
54
+ await cli . command ( 'breakOnNone' ) ;
55
+ await cli . stepCommand ( 'r' ) ;
65
56
assert . deepStrictEqual ( cli . breakInfo , { filename : script , line : 1 } ) ;
66
- } )
67
- . then ( ( ) => cli . command ( 'c' ) )
68
- . then ( ( ) => cli . waitFor ( / d i s c o n n e c t / ) )
69
- . then ( ( ) => cli . quit ( ) )
70
- . then ( null , onFatal ) ;
57
+ await cli . command ( 'c' ) ;
58
+ await cli . waitFor ( / d i s c o n n e c t / ) ;
59
+ await cli . quit ( ) ;
60
+ } finally {
61
+ onFatal ( ) ;
62
+ }
63
+ } ) ( ) . then ( common . mustCall ( ) ) ;
71
64
}
0 commit comments