Skip to content

Commit

Permalink
Merge branch 'sync-docs' of https://github.com/vitest-dev/docs-cn int…
Browse files Browse the repository at this point in the history
…o sync-3ae2cddc-1
  • Loading branch information
docschina-bot committed Oct 27, 2023
2 parents 777e49a + 3ae2cdd commit 48b9b6b
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ test('doNotRun', () => {
export interface BrowserProvider {
name: string
getSupportedBrowsers(): readonly string[]
initialize(ctx: Vitest, options: { browser: string }): Awaitable<void>
initialize(ctx: Vitest, options: { browser: string; options?: BrowserProviderOptions }): Awaitable<void>
openPage(url: string): Awaitable<void>
close(): Awaitable<void>
}
Expand All @@ -1394,6 +1394,42 @@ export interface BrowserProvider {
这是一个对库作者友好的的高级 API。如果你只需要在浏览器中运行测试,请使用 [browser](/config/#browser) 选项。
:::

#### browser.providerOptions

- **Type:** `BrowserProviderOptions`
- **Version:** Since Vitest 1.0.0-beta.3

Options that will be passed down to provider when calling `provider.initialize`.

```ts
export default defineConfig({
test: {
browser: {
providerOptions: {
launch: {
devtools: true,
}
}
}
}
})
```

::: tip
To have a better type safety when using built-in providers, you can add one of these types (for provider that you are using) to your tsconfig's `compilerOptions.types` field:

```json
{
"compilerOptions": {
"types": [
"@vitest/browser/providers/webdriverio",
"@vitest/browser/providers/playwright"
]
}
}
```
:::

#### browser.slowHijackESM

- **类型:** `boolean`
Expand Down

0 comments on commit 48b9b6b

Please sign in to comment.