@@ -34,7 +34,9 @@ describe('PHP Debug Adapter', () => {
3434 const program = path . join ( TEST_PROJECT , 'hello_world.php' )
3535
3636 it ( 'should error on non-existing file' , ( ) =>
37- assert . isRejected ( client . launch ( { program : 'thisfiledoesnotexist.php' } ) ) )
37+ assert . isRejected (
38+ Promise . all ( [ client . launch ( { program : 'thisfiledoesnotexist.php' } ) , client . configurationSequence ( ) ] )
39+ ) )
3840
3941 it ( 'should run program to the end' , ( ) =>
4042 Promise . all ( [
@@ -55,6 +57,7 @@ describe('PHP Debug Adapter', () => {
5557 it ( 'should not stop if launched without debugging' , ( ) =>
5658 Promise . all ( [
5759 client . launch ( { program, stopOnEntry : true , noDebug : true } ) ,
60+ client . configurationSequence ( ) ,
5861 client . waitForEvent ( 'terminated' ) ,
5962 ] ) )
6063 } )
@@ -70,7 +73,7 @@ describe('PHP Debug Adapter', () => {
7073 it ( 'should error on pause request' , ( ) => assert . isRejected ( client . pauseRequest ( { threadId : 1 } ) ) )
7174
7275 it ( 'should handle disconnect' , async ( ) => {
73- await Promise . all ( [ client . launch ( { program, stopOnEntry : true } ) , client . waitForEvent ( 'initialized' ) ] )
76+ await Promise . all ( [ client . launch ( { program, stopOnEntry : true } ) , client . configurationSequence ( ) ] )
7477 await client . disconnectRequest ( )
7578 } )
7679 } )
@@ -113,20 +116,18 @@ describe('PHP Debug Adapter', () => {
113116
114117 describe ( 'line breakpoints' , ( ) => {
115118 async function testBreakpointHit ( program : string , line : number ) : Promise < void > {
116- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
119+ client . launch ( { program } )
120+ await client . waitForEvent ( 'initialized' )
117121 const breakpoint = (
118122 await client . setBreakpointsRequest ( {
119123 breakpoints : [ { line } ] ,
120124 source : { path : program } ,
121125 } )
122126 ) . body . breakpoints [ 0 ]
123- await waitForBreakpointUpdate ( breakpoint )
127+ await client . configurationDoneRequest ( ) , await waitForBreakpointUpdate ( breakpoint )
124128 assert . isTrue ( breakpoint . verified , 'breakpoint verification mismatch: verified' )
125129 assert . equal ( breakpoint . line , line , 'breakpoint verification mismatch: line' )
126- await Promise . all ( [
127- client . configurationDoneRequest ( ) ,
128- assertStoppedLocation ( 'breakpoint' , program , line ) ,
129- ] )
130+ await assertStoppedLocation ( 'breakpoint' , program , line )
130131 }
131132
132133 it ( 'should stop on a breakpoint' , ( ) => testBreakpointHit ( program , 4 ) )
@@ -137,15 +138,16 @@ describe('PHP Debug Adapter', () => {
137138 it ( 'should stop on a breakpoint identical to the entrypoint' , ( ) => testBreakpointHit ( program , 3 ) )
138139
139140 it ( 'should support removing a breakpoint' , async ( ) => {
140- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
141+ client . launch ( { program } )
142+ await client . waitForEvent ( 'initialized' )
141143 // set two breakpoints
142144 let breakpoints = (
143145 await client . setBreakpointsRequest ( {
144146 breakpoints : [ { line : 3 } , { line : 5 } ] ,
145147 source : { path : program } ,
146148 } )
147149 ) . body . breakpoints
148- await waitForBreakpointUpdate ( breakpoints [ 0 ] )
150+ await client . configurationDoneRequest ( ) , await waitForBreakpointUpdate ( breakpoints [ 0 ] )
149151 await waitForBreakpointUpdate ( breakpoints [ 1 ] )
150152 assert . lengthOf ( breakpoints , 2 )
151153 assert . isTrue ( breakpoints [ 0 ] . verified , 'breakpoint verification mismatch: verified' )
@@ -177,13 +179,15 @@ describe('PHP Debug Adapter', () => {
177179 const program = path . join ( TEST_PROJECT , 'error.php' )
178180
179181 it ( 'should not break on anything if the file matches the ignore pattern' , async ( ) => {
180- await Promise . all ( [ client . launch ( { program, ignore : [ '**/*.*' ] } ) , client . waitForEvent ( 'initialized' ) ] )
182+ client . launch ( { program, ignore : [ '**/*.*' ] } )
183+ await client . waitForEvent ( 'initialized' )
181184 await client . setExceptionBreakpointsRequest ( { filters : [ '*' ] } )
182185 await Promise . all ( [ client . configurationDoneRequest ( ) , client . waitForEvent ( 'terminated' ) ] )
183186 } )
184187
185188 it ( 'should support stopping only on a notice' , async ( ) => {
186- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
189+ client . launch ( { program } )
190+ await client . waitForEvent ( 'initialized' )
187191 await client . setExceptionBreakpointsRequest ( { filters : [ 'Notice' ] } )
188192 const [ , { threadId } ] = await Promise . all ( [
189193 client . configurationDoneRequest ( ) ,
@@ -193,7 +197,8 @@ describe('PHP Debug Adapter', () => {
193197 } )
194198
195199 it ( 'should support stopping only on a warning' , async ( ) => {
196- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
200+ client . launch ( { program } )
201+ await client . waitForEvent ( 'initialized' )
197202 await client . setExceptionBreakpointsRequest ( { filters : [ 'Warning' ] } )
198203 const [ { threadId } ] = await Promise . all ( [
199204 assertStoppedLocation ( 'exception' , program , 9 ) ,
@@ -205,7 +210,8 @@ describe('PHP Debug Adapter', () => {
205210 it ( 'should support stopping only on an error' )
206211
207212 it ( 'should support stopping only on an exception' , async ( ) => {
208- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
213+ client . launch ( { program } )
214+ await client . waitForEvent ( 'initialized' )
209215 await client . setExceptionBreakpointsRequest ( { filters : [ 'Exception' ] } )
210216 const [ , { threadId } ] = await Promise . all ( [
211217 client . configurationDoneRequest ( ) ,
@@ -217,7 +223,8 @@ describe('PHP Debug Adapter', () => {
217223 // support for stopping on "*" was added in 2.3.0
218224 if ( ! process . env [ 'XDEBUG_VERSION' ] || semver . gte ( process . env [ 'XDEBUG_VERSION' ] , '2.3.0' ) ) {
219225 it ( 'should support stopping on everything' , async ( ) => {
220- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
226+ client . launch ( { program } )
227+ await client . waitForEvent ( 'initialized' )
221228 await client . setExceptionBreakpointsRequest ( { filters : [ '*' ] } )
222229 // Notice
223230 const [ , { threadId } ] = await Promise . all ( [
@@ -244,7 +251,8 @@ describe('PHP Debug Adapter', () => {
244251 }
245252
246253 it . skip ( 'should report the error in a virtual error scope' , async ( ) => {
247- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
254+ client . launch ( { program } )
255+ await client . waitForEvent ( 'initialized' )
248256 await client . setExceptionBreakpointsRequest ( { filters : [ 'Notice' , 'Warning' , 'Exception' ] } )
249257 const [
250258 {
@@ -324,20 +332,19 @@ describe('PHP Debug Adapter', () => {
324332 const program = path . join ( TEST_PROJECT , 'variables.php' )
325333
326334 it ( 'should stop on a conditional breakpoint when condition is true' , async ( ) => {
327- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
335+ client . launch ( { program } )
336+ await client . waitForEvent ( 'initialized' )
328337 const bp = (
329338 await client . setBreakpointsRequest ( {
330339 breakpoints : [ { line : 10 , condition : '$anInt === 123' } ] ,
331340 source : { path : program } ,
332341 } )
333342 ) . body . breakpoints [ 0 ]
343+ await client . configurationDoneRequest ( )
334344 await waitForBreakpointUpdate ( bp )
335345 assert . equal ( bp . verified , true , 'breakpoint verification mismatch: verified' )
336346 assert . equal ( bp . line , 10 , 'breakpoint verification mismatch: line' )
337- const [ , { frame } ] = await Promise . all ( [
338- client . configurationDoneRequest ( ) ,
339- assertStoppedLocation ( 'breakpoint' , program , 10 ) ,
340- ] )
347+ const { frame } = await assertStoppedLocation ( 'breakpoint' , program , 10 )
341348 const result = (
342349 await client . evaluateRequest ( {
343350 context : 'watch' ,
@@ -349,33 +356,37 @@ describe('PHP Debug Adapter', () => {
349356 } )
350357
351358 it ( 'should not stop on a conditional breakpoint when condition is false' , async ( ) => {
352- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
359+ client . launch ( { program } )
360+ await client . waitForEvent ( 'initialized' )
353361 const bp = (
354362 await client . setBreakpointsRequest ( {
355363 breakpoints : [ { line : 10 , condition : '$anInt !== 123' } ] ,
356364 source : { path : program } ,
357365 } )
358366 ) . body . breakpoints [ 0 ]
367+ await client . configurationDoneRequest ( )
359368 await waitForBreakpointUpdate ( bp )
360369 assert . equal ( bp . verified , true , 'breakpoint verification mismatch: verified' )
361370 assert . equal ( bp . line , 10 , 'breakpoint verification mismatch: line' )
362- await Promise . all ( [ client . configurationDoneRequest ( ) , client . waitForEvent ( 'terminated' ) ] )
371+ await client . waitForEvent ( 'terminated' )
363372 } )
364373 } )
365374
366375 describe ( 'function breakpoints' , ( ) => {
367376 const program = path . join ( TEST_PROJECT , 'function.php' )
368377
369378 it ( 'should stop on a function breakpoint' , async ( ) => {
370- await Promise . all ( [ client . launch ( { program } ) , client . waitForEvent ( 'initialized' ) ] )
379+ client . launch ( { program } )
380+ await client . waitForEvent ( 'initialized' )
371381 const breakpoint = (
372382 await client . setFunctionBreakpointsRequest ( {
373383 breakpoints : [ { name : 'a_function' } ] ,
374384 } )
375385 ) . body . breakpoints [ 0 ]
386+ await client . configurationDoneRequest ( )
376387 await waitForBreakpointUpdate ( breakpoint )
377388 assert . strictEqual ( breakpoint . verified , true )
378- await Promise . all ( [ client . configurationDoneRequest ( ) , assertStoppedLocation ( 'breakpoint' , program , 5 ) ] )
389+ await assertStoppedLocation ( 'breakpoint' , program , 5 )
379390 } )
380391 } )
381392 } )
@@ -388,16 +399,14 @@ describe('PHP Debug Adapter', () => {
388399 let constantsScope : DebugProtocol . Scope | undefined
389400
390401 beforeEach ( async ( ) => {
391- await Promise . all ( [
392- client . launch ( {
393- program,
394- xdebugSettings : {
395- max_data : 10000 ,
396- max_children : 100 ,
397- } ,
398- } ) ,
399- client . waitForEvent ( 'initialized' ) ,
400- ] )
402+ client . launch ( {
403+ program,
404+ xdebugSettings : {
405+ max_data : 10000 ,
406+ max_children : 100 ,
407+ } ,
408+ } )
409+ await client . waitForEvent ( 'initialized' )
401410 await client . setBreakpointsRequest ( { source : { path : program } , breakpoints : [ { line : 19 } ] } )
402411 const [ , event ] = await Promise . all ( [
403412 client . configurationDoneRequest ( ) ,
0 commit comments