Skip to content

Commit

Permalink
fix(browser): fix provider options types (#7115)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Dec 23, 2024
1 parent 843a621 commit 579bda9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/browser/providers/playwright.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import type {
} from 'playwright'
import { Protocol } from 'playwright-core/types/protocol'
import '../matchers.js'
import type {} from "vitest/node"

declare module 'vitest/node' {
interface BrowserProviderOptions {
export interface BrowserProviderOptions {
launch?: LaunchOptions
context?: Omit<
BrowserContextOptions,
Expand Down
3 changes: 2 additions & 1 deletion packages/browser/providers/webdriverio.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { RemoteOptions, ClickOptions, DragAndDropOptions } from 'webdriverio'
import '../matchers.js'
import type {} from "vitest/node"

declare module 'vitest/node' {
interface BrowserProviderOptions extends Partial<RemoteOptions> {}
export interface BrowserProviderOptions extends Partial<RemoteOptions> {}

export interface UserEventClickOptions extends ClickOptions {}

Expand Down
1 change: 0 additions & 1 deletion test/dts-playwright/src/basic.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="@vitest/browser/providers/playwright" />
import { page, userEvent } from '@vitest/browser/context'
import { test } from 'vitest'

Expand Down
3 changes: 2 additions & 1 deletion test/dts-playwright/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["@vitest/browser/providers/playwright"],
"strict": true,
"noEmit": true
},
"include": ["src"]
"include": ["src", "*.ts"]
}
26 changes: 26 additions & 0 deletions test/dts-playwright/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
browser: {
provider: 'playwright',
providerOptions: {
launch: {
timeout: 1234,
// @ts-expect-error test type error
slowMo: 'wrong',
},
},
instances: [
{
browser: 'chromium',
launch: {
timeout: 1234,
// @ts-expect-error test type error
slowMo: 'wrong',
},
},
],
},
},
})

0 comments on commit 579bda9

Please sign in to comment.