Skip to content

Commit

Permalink
fix: Catch exceptions on browser close or disconnect during teardown (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
muka authored Nov 23, 2021
1 parent 8584363 commit adafcc2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/jest-environment-puppeteer/src/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ export async function teardown(jestConfig = {}) {
await Promise.all(
browsers.map((browser) => {
if (config.connect) {
return browser.disconnect()
return browser.disconnect().catch((e) => {
console.error(`global.js teardown: Error disconnecting browser ${e.stack}`)
})
}
return browser.close()
return browser.close().catch((e) => {
console.error(`global.js teardown: Error closing browser ${e.stack}`)
})
}),
)

Expand Down

0 comments on commit adafcc2

Please sign in to comment.