File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed
Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ module.exports = class ReactBenchmark extends EventEmitter {
2828 } )
2929 }
3030
31- _shutdown ( ) {
32- this . chrome . stop ( )
33- this . server . stop ( )
31+ async _shutdown ( ) {
32+ await this . chrome . stop ( )
33+ await this . server . stop ( )
3434 this . running = false
3535 }
3636
@@ -61,19 +61,17 @@ module.exports = class ReactBenchmark extends EventEmitter {
6161 const port = await this . server . start ( outputPath )
6262
6363 return new Promise ( ( resolve , reject ) => {
64- this . chrome . once ( 'complete' , ( benchmark ) => {
64+ this . chrome . once ( 'complete' , async ( benchmark ) => {
6565 if ( ! devtools ) {
66- this . _shutdown ( )
66+ await this . _shutdown ( )
6767 }
68-
6968 resolve ( benchmark )
7069 } )
7170
72- this . chrome . once ( 'error' , ( err ) => {
71+ this . chrome . once ( 'error' , async ( err ) => {
7372 if ( ! devtools ) {
74- this . _shutdown ( )
73+ await this . _shutdown ( )
7574 }
76-
7775 reject ( err )
7876 } )
7977
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ const path = require('path')
22const test = require ( 'ava' )
33const execa = require ( 'execa' )
44
5- const sleep = ( ms ) => new Promise ( ( res ) => setTimeout ( res , ms ) )
6-
75test ( 'runs benchmark' , async ( t ) => {
86 const binPath = path . resolve ( __dirname , '../lib/cli.js' )
97 const fixturePath = path . resolve ( __dirname , 'fixtures/benchmark.js' )
@@ -23,7 +21,6 @@ test('throttles CPU', async (t) => {
2321 const fixturePath = path . resolve ( __dirname , 'fixtures/benchmark.js' )
2422
2523 const woutT = ( await execa ( binPath , [ fixturePath ] ) ) . stdout
26- await sleep ( 100 ) // sometimes port is still in use
2724 const withT = ( await execa ( binPath , [ fixturePath , '--cpuThrottle=4' ] ) ) . stdout
2825
2926 // difference should be more then 2 times
You can’t perform that action at this time.
0 commit comments