chore: extract puppeteer launch options to type (#8448)

This commit is contained in:
jrandolf 2022-05-31 19:54:25 +02:00 committed by GitHub
parent 9f9a1a4dd5
commit 3f4451eff7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,17 @@ import Launcher, { ProductLauncher } from './Launcher.js';
import { PUPPETEER_REVISIONS } from '../revisions.js';
import { Product } from '../common/Product.js';
/**
* @public
*/
export interface PuppeteerLaunchOptions
extends LaunchOptions,
BrowserLaunchArgumentOptions,
BrowserConnectOptions {
product?: Product;
extraPrefsFirefox?: Record<string, unknown>;
}
/**
* Extends the main {@link Puppeteer} class with Node specific behaviour for fetching and
* downloading browsers.
@ -143,14 +154,7 @@ export class PuppeteerNode extends Puppeteer {
* @param options - Set of configurable options to set on the browser.
* @returns Promise which resolves to browser instance.
*/
launch(
options: LaunchOptions &
BrowserLaunchArgumentOptions &
BrowserConnectOptions & {
product?: Product;
extraPrefsFirefox?: Record<string, unknown>;
} = {}
): Promise<Browser> {
launch(options: PuppeteerLaunchOptions = {}): Promise<Browser> {
if (options.product) this._productName = options.product;
return this._launcher.launch(options);
}