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'; import {isNode} from '../environment.js';
declare global { declare global {
// eslint-disable-next-line no-var const __PUPPETEER_DEBUG: string;
var __PUPPETEER_DEBUG: string;
} }
/** /**

View File

@ -190,11 +190,9 @@ export function bubble<T extends EventType[]>(events?: T) {
emitter.on('*', handler); emitter.on('*', handler);
set.call(this, emitter); set.call(this, emitter);
}, },
// @ts-expect-error -- TypeScript incorrectly types init to require a
// return.
init(emitter) { init(emitter) {
if (emitter === undefined) { if (emitter === undefined) {
return; return emitter;
} }
const handler = bubbleHandlers.get(this)!.get(events)!; const handler = bubbleHandlers.get(this)!.get(events)!;

View File

@ -207,14 +207,10 @@ describe('OOPIF', function () {
); );
const frame = await framePromise; const frame = await framePromise;
await frame.evaluate(() => { await frame.evaluate(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment (window as any)._test = 'Test 123!';
// @ts-expect-error
_test = 'Test 123!';
}); });
const result = await frame.evaluate(() => { const result = await frame.evaluate(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment return (window as any)._test;
// @ts-expect-error
return window._test;
}); });
expect(result).toBe('Test 123!'); expect(result).toBe('Test 123!');
}); });

View File

@ -134,8 +134,11 @@ describe('request interception', function () {
await cdp.send('DOM.enable'); await cdp.send('DOM.enable');
const urls: string[] = []; const urls: string[] = [];
page.on('request', request => { page.on('request', request => {
void request.continue();
if (isFavicon(request)) {
return;
}
urls.push(request.url()); urls.push(request.url());
return request.continue();
}); });
// This causes network requests without networkId. // This causes network requests without networkId.
await cdp.send('CSS.enable'); await cdp.send('CSS.enable');