Skip to content

Commit

Permalink
chore: update types and test (puppeteer#12564)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade authored Jun 10, 2024
1 parent 8b2059f commit 33b3cef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions packages/puppeteer-core/src/common/Debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions packages/puppeteer-core/src/util/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)!;

Expand Down
8 changes: 2 additions & 6 deletions test/src/oopif.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
Expand Down
5 changes: 4 additions & 1 deletion test/src/requestinterception.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 33b3cef

Please sign in to comment.