11"use strict" ;
22
3- const EventEmitter = require ( "events" ) . EventEmitter ;
43const _ = require ( "lodash" ) ;
54const { ExistingBrowser } = require ( "src/browser/existing-browser" ) ;
65const BrowserPool = require ( "src/worker/runner/browser-pool" ) ;
76const { Calibrator } = require ( "src/browser/calibrator" ) ;
8- const { WorkerEvents : RunnerEvents } = require ( "src/events" ) ;
7+ const { WorkerEvents : RunnerEvents , AsyncEmitter } = require ( "src/events" ) ;
98const ipc = require ( "src/utils/ipc" ) ;
109
1110describe ( "worker/browser-pool" , ( ) => {
@@ -20,7 +19,7 @@ describe("worker/browser-pool", () => {
2019 const createPool = opts => {
2120 opts = _ . defaults ( opts || { } , {
2221 config : stubConfig ( ) ,
23- emitter : new EventEmitter ( ) ,
22+ emitter : new AsyncEmitter ( ) ,
2423 } ) ;
2524
2625 return BrowserPool . create ( opts . config , opts . emitter ) ;
@@ -48,7 +47,7 @@ describe("worker/browser-pool", () => {
4847 describe ( "getBrowser" , ( ) => {
4948 it ( "should create browser with correct args" , async ( ) => {
5049 const config = stubConfig ( ) ;
51- const emitter = new EventEmitter ( ) ;
50+ const emitter = new AsyncEmitter ( ) ;
5251 const browserPool = createPool ( { config, emitter } ) ;
5352 ExistingBrowser . create . returns ( stubBrowser ( { browserId : "bro-id" } ) ) ;
5453
@@ -81,7 +80,7 @@ describe("worker/browser-pool", () => {
8180 } ) ;
8281
8382 it ( 'should emit "NEW_BROWSER" event on creating of a browser' , async ( ) => {
84- const emitter = new EventEmitter ( ) ;
83+ const emitter = new AsyncEmitter ( ) ;
8584 const onNewBrowser = sandbox . spy ( ) . named ( "onNewBrowser" ) ;
8685 const browserPool = createPool ( { emitter } ) ;
8786
0 commit comments