mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-06 03:16:17 +03:00
types: allow readonly tuples to be used as ReporterDescription
(#30387)
This makes it easier to create helper functions like: ```ts function createReporter(options: MyOptions) { return ['my-reporter', options] as const } ``` At the moment, such functions can't be passed to `reporters` because a readonly array is not assignable to the expected mutable array. Playwirght certainly doesn't require those arrays to be mutable so it would make sense to relax this.
This commit is contained in:
parent
cda1c945af
commit
82aefd24db
5
packages/playwright/types/test.d.ts
vendored
5
packages/playwright/types/test.d.ts
vendored
@ -18,7 +18,7 @@
|
||||
import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, Page, LaunchOptions, ViewportSize, Geolocation, HTTPCredentials, Locator, APIResponse, PageScreenshotOptions } from 'playwright-core';
|
||||
export * from 'playwright-core';
|
||||
|
||||
export type ReporterDescription =
|
||||
export type ReporterDescription = Readonly<
|
||||
['blob'] | ['blob', { outputDir?: string, fileName?: string }] |
|
||||
['dot'] |
|
||||
['line'] |
|
||||
@ -28,7 +28,8 @@ export type ReporterDescription =
|
||||
['json'] | ['json', { outputFile?: string }] |
|
||||
['html'] | ['html', { outputFolder?: string, open?: 'always' | 'never' | 'on-failure', host?: string, port?: number, attachmentsBaseURL?: string }] |
|
||||
['null'] |
|
||||
[string] | [string, any];
|
||||
[string] | [string, any]
|
||||
>;
|
||||
|
||||
type UseOptions<TestArgs, WorkerArgs> = Partial<WorkerArgs> & Partial<TestArgs>;
|
||||
|
||||
|
5
utils/generate_types/overrides-test.d.ts
vendored
5
utils/generate_types/overrides-test.d.ts
vendored
@ -17,7 +17,7 @@
|
||||
import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, Page, LaunchOptions, ViewportSize, Geolocation, HTTPCredentials, Locator, APIResponse, PageScreenshotOptions } from 'playwright-core';
|
||||
export * from 'playwright-core';
|
||||
|
||||
export type ReporterDescription =
|
||||
export type ReporterDescription = Readonly<
|
||||
['blob'] | ['blob', { outputDir?: string, fileName?: string }] |
|
||||
['dot'] |
|
||||
['line'] |
|
||||
@ -27,7 +27,8 @@ export type ReporterDescription =
|
||||
['json'] | ['json', { outputFile?: string }] |
|
||||
['html'] | ['html', { outputFolder?: string, open?: 'always' | 'never' | 'on-failure', host?: string, port?: number, attachmentsBaseURL?: string }] |
|
||||
['null'] |
|
||||
[string] | [string, any];
|
||||
[string] | [string, any]
|
||||
>;
|
||||
|
||||
type UseOptions<TestArgs, WorkerArgs> = Partial<WorkerArgs> & Partial<TestArgs>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user