Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Nov 26, 2024
1 parent a9789d0 commit 2b87035
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ export default ({ mode }: { mode: string }) => {
},

nav: [
{ text: 'Guide & API', link: '/guide/', activeMatch: '^/(guide|api|config)/(?!browser)' },
{ text: 'Guide & API', link: '/guide/', activeMatch: '^/(guide|api)/(?!browser)' },
{ text: 'Config', link: '/config/', activeMatch: '^/config/' },
{ text: 'Browser Mode', link: '/guide/browser', activeMatch: '^/guide/browser/' },
{
text: 'Resources',
Expand Down
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,7 @@ export default {
```

::: tip
To have a better type safety when using built-in providers, you should reference one of these types (for provider that you are using) in your [config file](/config/file):
To have a better type safety when using built-in providers, you should reference one of these types (for provider that you are using) in your [config file](/config/):

```ts
/// <reference types="@vitest/browser/providers/playwright" />
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/browser/assertion-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Vitest bundles the [`@testing-library/jest-dom`](https://github.com/testing-libr
- [`toHaveRole`](https://github.com/testing-library/jest-dom#toHaveRole)
- [`toHaveErrorMessage`](https://github.com/testing-library/jest-dom#toHaveErrorMessage)

If you are using [TypeScript](/guide/browser/#typescript) or want to have correct type hints in `expect`, make sure you have either `@vitest/browser/providers/playwright` or `@vitest/browser/providers/webdriverio` referenced in your [setup file](/config/#setupfile) or a [config file](/config/file) depending on the provider you use. If you use the default `preview` provider, you can specify `@vitest/browser/matchers` instead.
If you are using [TypeScript](/guide/browser/#typescript) or want to have correct type hints in `expect`, make sure you have either `@vitest/browser/providers/playwright` or `@vitest/browser/providers/webdriverio` referenced in your [setup file](/config/#setupfile) or a [config file](/config/) depending on the provider you use. If you use the default `preview` provider, you can specify `@vitest/browser/matchers` instead.

::: code-group
```ts [preview]
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/browser/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const myCommand: BrowserCommand<[string, number]> = async (
```

::: tip
If you are using TypeScript, don't forget to reference `@vitest/browser/providers/playwright` in your [setup file](/config/#setupfile) or a [config file](/config/file) to get autocompletion in the config and in `userEvent` and `page` options:
If you are using TypeScript, don't forget to reference `@vitest/browser/providers/playwright` in your [setup file](/config/#setupfile) or a [config file](/config/) to get autocompletion in the config and in `userEvent` and `page` options:

```ts
/// <reference types="@vitest/browser/providers/playwright" />
Expand All @@ -165,7 +165,7 @@ Vitest exposes some `webdriverio` specific properties on the context object.
Vitest automatically switches the `webdriver` context to the test iframe by calling `browser.switchToFrame` before the command is called, so `$` and `$$` methods refer to the elements inside the iframe, not in the orchestrator, but non-webdriver APIs will still refer to the parent frame context.

::: tip
If you are using TypeScript, don't forget to reference `@vitest/browser/providers/webdriverio` in your [setup file](/config/#setupfile) or a [config file](/config/file) to get autocompletion:
If you are using TypeScript, don't forget to reference `@vitest/browser/providers/webdriverio` in your [setup file](/config/#setupfile) or a [config file](/config/) to get autocompletion:

```ts
/// <reference types="@vitest/browser/providers/webdriverio" />
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/browser/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ The browser option in Vitest depends on the provider. Vitest will fail, if you p

## TypeScript

By default, TypeScript doesn't recognize providers options and extra `expect` properties. If you don't use any providers, make sure the `@vitest/browser/matchers` is referenced somewhere in your tests, [setup file](/config/#setupfile) or a [config file](/config/file) to pick up the extra `expect` definitions. If you are using custom providers, make sure to add `@vitest/browser/providers/playwright` or `@vitest/browser/providers/webdriverio` to the same file so TypeScript can pick up definitions for custom options:
By default, TypeScript doesn't recognize providers options and extra `expect` properties. If you don't use any providers, make sure the `@vitest/browser/matchers` is referenced somewhere in your tests, [setup file](/config/#setupfile) or a [config file](/config/) to pick up the extra `expect` definitions. If you are using custom providers, make sure to add `@vitest/browser/providers/playwright` or `@vitest/browser/providers/webdriverio` to the same file so TypeScript can pick up definitions for custom options:

::: code-group
```ts [default]
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/browser/interactivity-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { userEvent } from '@vitest/browser/context'
await userEvent.click(document.querySelector('.button'))
```

Almost every `userEvent` method inherits its provider options. To see all available options in your IDE, add `webdriver` or `playwright` types (depending on your provider) to your [setup file](/config/#setupfile) or a [config file](/config/file) (depending on what is in `included` in your `tsconfig.json`):
Almost every `userEvent` method inherits its provider options. To see all available options in your IDE, add `webdriver` or `playwright` types (depending on your provider) to your [setup file](/config/#setupfile) or a [config file](/config/) (depending on what is in `included` in your `tsconfig.json`):

::: code-group
```ts [playwright]
Expand Down

0 comments on commit 2b87035

Please sign in to comment.