Skip to content

Commit 1a907f7

Browse files
committed
fix(types): do not require @types/node because of puppeteer types
1 parent eb02517 commit 1a907f7

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/testing/puppeteer/puppeteer-declarations.ts

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import type { EventInitDict, EventSpy, ScreenshotDiff, ScreenshotOptions } from '@stencil/core/internal';
2-
import type * as puppeteer from 'puppeteer';
3-
4-
export interface NewE2EPageOptions extends puppeteer.NavigationOptions {
2+
import type {
3+
ClickOptions,
4+
NavigationOptions,
5+
Page,
6+
PageCloseOptions,
7+
ScreenshotOptions as PuppeteerScreenshotOptions,
8+
Response,
9+
} from 'puppeteer';
10+
11+
export interface NewE2EPageOptions extends NavigationOptions {
512
url?: string;
613
html?: string;
714
failOnConsoleError?: boolean;
@@ -10,7 +17,7 @@ export interface NewE2EPageOptions extends puppeteer.NavigationOptions {
1017

1118
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
1219
type PuppeteerPage = Omit<
13-
puppeteer.Page,
20+
Page,
1421
| 'bringToFront'
1522
| 'browser'
1623
| 'screenshot'
@@ -120,15 +127,15 @@ export interface E2EPage extends PuppeteerPage {
120127
* a localhost address. A shortcut to `page.goto(url)` is to set the `url` option
121128
* when creating a new page, such as `const page = await newE2EPage({ url })`.
122129
*/
123-
goTo(url: string, options?: puppeteer.NavigationOptions): Promise<puppeteer.Response | null>;
130+
goTo(url: string, options?: NavigationOptions): Promise<Response | null>;
124131

125132
/**
126133
* Instead of testing a url directly, html content can be mocked using
127134
* `page.setContent(html)`. A shortcut to `page.setContent(html)` is to set
128135
* the `html` option when creating a new page, such as
129136
* `const page = await newE2EPage({ html })`.
130137
*/
131-
setContent(html: string, options?: puppeteer.NavigationOptions): Promise<void>;
138+
setContent(html: string, options?: NavigationOptions): Promise<void>;
132139

133140
/**
134141
* Used to test if an event was, or was not dispatched. This method
@@ -162,9 +169,9 @@ export interface E2EPageInternal extends E2EPage {
162169
_e2eElements: E2EElementInternal[];
163170
_e2eEvents: Map<number, WaitForEvent>;
164171
_e2eEventIds: number;
165-
_e2eGoto(url: string, options?: Partial<puppeteer.NavigationOptions>): Promise<puppeteer.Response | null>;
166-
_e2eClose(options?: puppeteer.PageCloseOptions): Promise<void>;
167-
screenshot(options?: puppeteer.ScreenshotOptions): Promise<Buffer>;
172+
_e2eGoto(url: string, options?: Partial<NavigationOptions>): Promise<Response | null>;
173+
_e2eClose(options?: PageCloseOptions): Promise<void>;
174+
screenshot(options?: PuppeteerScreenshotOptions): Promise<Buffer>;
168175
}
169176

170177
export interface E2EElement {
@@ -215,7 +222,7 @@ export interface E2EElement {
215222
* then uses `page.mouse` to click in the center of the element.
216223
* Please see the puppeteer docs for more information.
217224
*/
218-
click(options?: puppeteer.ClickOptions): Promise<void>;
225+
click(options?: ClickOptions): Promise<void>;
219226

220227
/**
221228
* Find a child element that matches the selector, which is the same as

0 commit comments

Comments
 (0)