Skip to content

Commit

Permalink
Do not recreate browser instance if getBrowser options passed
Browse files Browse the repository at this point in the history
  • Loading branch information
sunify committed May 9, 2018
1 parent 4d5c2ff commit d126e41
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ const launchBrowserIfNeeded = async function ({ getBrowser }) {
if (browser) {
return
}
if (getBrowser && typeof getBrowser === 'function') {
_browserLaunchPromise = Promise.resolve(getBrowser())
if (
getBrowser &&
typeof getBrowser === 'function' &&
!_browserLaunchPromise
) {
_browserLaunchPromise = getBrowser()
}
if (!_browserLaunchPromise) {
debuglog('no browser instance, launching new browser..')
Expand Down

0 comments on commit d126e41

Please sign in to comment.