From 7afbb2ed4a84db25f4257ba9c2e2f08d26beeff4 Mon Sep 17 00:00:00 2001 From: Donovan Graham Date: Thu, 6 Dec 2018 18:56:19 +0200 Subject: [PATCH] fix: use browser.disconnect method Use the `.disconnect` method when connecting to long-running or external chromium. As documented here: https://pptr.dev/#?product=Puppeteer&version=v1.11.0&show=api-browserdisconnect --- packages/jest-environment-puppeteer/src/global.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/jest-environment-puppeteer/src/global.js b/packages/jest-environment-puppeteer/src/global.js index df83ff18..c8481ddc 100644 --- a/packages/jest-environment-puppeteer/src/global.js +++ b/packages/jest-environment-puppeteer/src/global.js @@ -50,9 +50,12 @@ export async function setup() { } export async function teardown() { - const config = await readConfig() await teardownServer() - if (!config.connect) { + + const config = await readConfig() + if (config.connect) { + await browser.disconnect(); + } else { await browser.close() } }