chore: update types and test (#12564)

This commit is contained in:
Nikolay Vitkov 2024-06-10 17:54:55 +02:00 committed by GitHub
parent 8b2059f82a
commit 33b3cefb83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 12 deletions

View File

@ -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;
}
/**

View File

@ -190,11 +190,9 @@ export function bubble<T extends EventType[]>(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)!;

View File

@ -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!');
});

View File

@ -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');