From e9f0d035ceda9ffc38b6829989a950cac7adcade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipi=C5=84ski?= Date: Sun, 1 Jan 2023 17:13:19 +0100 Subject: [PATCH] docs: improve custom puppeteer example to prevent worker warnings (#13619) --- CHANGELOG.md | 1 + docs/Puppeteer.md | 3 +++ website/versioned_docs/version-25.x/Puppeteer.md | 3 +++ website/versioned_docs/version-26.x/Puppeteer.md | 3 +++ website/versioned_docs/version-27.x/Puppeteer.md | 3 +++ website/versioned_docs/version-28.x/Puppeteer.md | 3 +++ website/versioned_docs/version-29.0/Puppeteer.md | 3 +++ website/versioned_docs/version-29.1/Puppeteer.md | 3 +++ website/versioned_docs/version-29.2/Puppeteer.md | 3 +++ website/versioned_docs/version-29.3/Puppeteer.md | 3 +++ 10 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2611f1bbae31..da6544d64a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Chore & Maintenance - `[@jest/fake-timers]` Update `@sinonjs/fake-timers` ([#13612](https://github.com/facebook/jest/pull/13612)) +- `[docs]` Improve custom puppeteer example to prevent worker warnings ([#13619](https://github.com/facebook/jest/pull/13619)) ### Performance diff --git a/docs/Puppeteer.md b/docs/Puppeteer.md index 5752f7cba96d..d437bda3743f 100644 --- a/docs/Puppeteer.md +++ b/docs/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-25.x/Puppeteer.md b/website/versioned_docs/version-25.x/Puppeteer.md index e31285ea9b02..c1aafd6ba637 100644 --- a/website/versioned_docs/version-25.x/Puppeteer.md +++ b/website/versioned_docs/version-25.x/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-26.x/Puppeteer.md b/website/versioned_docs/version-26.x/Puppeteer.md index e31285ea9b02..c1aafd6ba637 100644 --- a/website/versioned_docs/version-26.x/Puppeteer.md +++ b/website/versioned_docs/version-26.x/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-27.x/Puppeteer.md b/website/versioned_docs/version-27.x/Puppeteer.md index c3e51d2a16c7..7d4b6576c86b 100644 --- a/website/versioned_docs/version-27.x/Puppeteer.md +++ b/website/versioned_docs/version-27.x/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-28.x/Puppeteer.md b/website/versioned_docs/version-28.x/Puppeteer.md index 5752f7cba96d..d437bda3743f 100644 --- a/website/versioned_docs/version-28.x/Puppeteer.md +++ b/website/versioned_docs/version-28.x/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-29.0/Puppeteer.md b/website/versioned_docs/version-29.0/Puppeteer.md index 5752f7cba96d..d437bda3743f 100644 --- a/website/versioned_docs/version-29.0/Puppeteer.md +++ b/website/versioned_docs/version-29.0/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-29.1/Puppeteer.md b/website/versioned_docs/version-29.1/Puppeteer.md index 5752f7cba96d..d437bda3743f 100644 --- a/website/versioned_docs/version-29.1/Puppeteer.md +++ b/website/versioned_docs/version-29.1/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-29.2/Puppeteer.md b/website/versioned_docs/version-29.2/Puppeteer.md index 5752f7cba96d..d437bda3743f 100644 --- a/website/versioned_docs/version-29.2/Puppeteer.md +++ b/website/versioned_docs/version-29.2/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); } diff --git a/website/versioned_docs/version-29.3/Puppeteer.md b/website/versioned_docs/version-29.3/Puppeteer.md index 5752f7cba96d..d437bda3743f 100644 --- a/website/versioned_docs/version-29.3/Puppeteer.md +++ b/website/versioned_docs/version-29.3/Puppeteer.md @@ -108,6 +108,9 @@ class PuppeteerEnvironment extends NodeEnvironment { } async teardown() { + if (this.global.__BROWSER_GLOBAL__) { + this.global.__BROWSER_GLOBAL__.disconnect(); + } await super.teardown(); }