From 33b3cefb8375b123c2709c0816a8cf38393b0bc7 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Mon, 10 Jun 2024 17:54:55 +0200 Subject: [PATCH] chore: update types and test (#12564) --- packages/puppeteer-core/src/common/Debug.ts | 3 +-- packages/puppeteer-core/src/util/decorators.ts | 4 +--- test/src/oopif.spec.ts | 8 ++------ test/src/requestinterception.spec.ts | 5 ++++- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/puppeteer-core/src/common/Debug.ts b/packages/puppeteer-core/src/common/Debug.ts index 06ac9f58f9c..20b8df13a7d 100644 --- a/packages/puppeteer-core/src/common/Debug.ts +++ b/packages/puppeteer-core/src/common/Debug.ts @@ -9,8 +9,7 @@ import type Debug from 'debug'; import {isNode} from '../environment.js'; declare global { - // eslint-disable-next-line no-var - var __PUPPETEER_DEBUG: string; + const __PUPPETEER_DEBUG: string; } /** diff --git a/packages/puppeteer-core/src/util/decorators.ts b/packages/puppeteer-core/src/util/decorators.ts index c4dc3b6c0df..8859eac540f 100644 --- a/packages/puppeteer-core/src/util/decorators.ts +++ b/packages/puppeteer-core/src/util/decorators.ts @@ -190,11 +190,9 @@ export function bubble(events?: T) { emitter.on('*', handler); set.call(this, emitter); }, - // @ts-expect-error -- TypeScript incorrectly types init to require a - // return. init(emitter) { if (emitter === undefined) { - return; + return emitter; } const handler = bubbleHandlers.get(this)!.get(events)!; diff --git a/test/src/oopif.spec.ts b/test/src/oopif.spec.ts index a36a8bc8673..d5ff0c64165 100644 --- a/test/src/oopif.spec.ts +++ b/test/src/oopif.spec.ts @@ -207,14 +207,10 @@ describe('OOPIF', function () { ); const frame = await framePromise; await frame.evaluate(() => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error - _test = 'Test 123!'; + (window as any)._test = 'Test 123!'; }); const result = await frame.evaluate(() => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-expect-error - return window._test; + return (window as any)._test; }); expect(result).toBe('Test 123!'); }); diff --git a/test/src/requestinterception.spec.ts b/test/src/requestinterception.spec.ts index e5d4a6ba35c..fe3e84676e8 100644 --- a/test/src/requestinterception.spec.ts +++ b/test/src/requestinterception.spec.ts @@ -134,8 +134,11 @@ describe('request interception', function () { await cdp.send('DOM.enable'); const urls: string[] = []; page.on('request', request => { + void request.continue(); + if (isFavicon(request)) { + return; + } urls.push(request.url()); - return request.continue(); }); // This causes network requests without networkId. await cdp.send('CSS.enable');