@@ -419,53 +419,28 @@ describe('Client console.log', () => {
419
419
} ,
420
420
] ;
421
421
422
- transportModes . forEach ( ( mode ) => {
423
- cases . forEach ( ( { title, options } ) => {
422
+ transportModes . forEach ( async ( mode ) => {
423
+ await cases . forEach ( async ( { title, options } ) => {
424
424
title += ` (${
425
425
Object . keys ( mode ) . length ? mode . transportMode : 'default'
426
426
} )`;
427
427
options = { ...mode , ...options } ;
428
- it ( title , ( done ) => {
428
+ const testOptions = Object . assign ( { } , baseOptions , options ) ;
429
+ await it ( title , async ( done ) => {
430
+ await testServer . startAwaitingCompilation ( config , testOptions ) ;
429
431
const res = [ ] ;
430
- const testOptions = Object . assign ( { } , baseOptions , options ) ;
431
-
432
- // TODO: use async/await when Node.js v6 support is dropped
433
- Promise . resolve ( )
434
- . then ( ( ) => {
435
- return new Promise ( ( resolve ) => {
436
- testServer . startAwaitingCompilation ( config , testOptions , resolve ) ;
437
- } ) ;
438
- } )
439
- . then ( ( ) => {
440
- // make sure the previous Promise is not passing along strange arguments to runBrowser
441
- return runBrowser ( ) ;
442
- } )
443
- . then ( ( { page, browser } ) => {
444
- return new Promise ( ( resolve ) => {
445
- page . goto ( `http://localhost:${ port2 } /main` ) ;
446
- page . on ( 'console' , ( { _text } ) => {
447
- res . push ( _text ) ;
448
- } ) ;
449
- // wait for load before closing the browser
450
- page . waitForNavigation ( { waitUntil : 'load' } ) . then ( ( ) => {
451
- page . waitFor ( beforeBrowserCloseDelay ) . then ( ( ) => {
452
- browser . close ( ) . then ( ( ) => {
453
- resolve ( ) ;
454
- } ) ;
455
- } ) ;
456
- } ) ;
457
- } ) ;
458
- } )
459
- . then ( ( ) => {
460
- return new Promise ( ( resolve ) => {
461
- testServer . close ( resolve ) ;
462
- } ) ;
463
- } )
464
- . then ( ( ) => {
465
- // Order doesn't matter, maybe we should improve that in future
466
- expect ( res . sort ( ) ) . toMatchSnapshot ( ) ;
467
- done ( ) ;
468
- } ) ;
432
+ const { page, browser } = await runBrowser ( ) ;
433
+ page . goto ( `http://localhost:${ port2 } /main` ) ;
434
+ page . on ( 'console' , ( { _text } ) => {
435
+ res . push ( _text ) ;
436
+ } ) ;
437
+ // wait for load before closing the browser
438
+ await page . waitForNavigation ( { waitUntil : 'load' } ) ;
439
+ await page . waitFor ( beforeBrowserCloseDelay ) ;
440
+ await browser . close ( ) ;
441
+ // Order doesn't matter, maybe we should improve that in future
442
+ await expect ( res . sort ( ) ) . toMatchSnapshot ( ) ;
443
+ await testServer . close ( done ) ;
469
444
} ) ;
470
445
} ) ;
471
446
} ) ;
0 commit comments