Skip to content

Commit

Permalink
docs: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Sep 16, 2023
1 parent d73ce9b commit 833a46d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/api/vi.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ Wait for the callback to execute successfully. If the callback throws an error o
This is very useful when you need to wait for some asynchronous action to complete, for example, when you start a server and need to wait for it to start.

```ts
import { test, vi } from 'vitest'
import { expect, test, vi } from 'vitest'
test('Server started successfully', async () => {
let server = false
Expand All @@ -756,7 +756,7 @@ test('Server started successfully', async () => {
It also works for asynchronous callbacks

```ts
import { test, vi } from 'vitest'
import { expect, test, vi } from 'vitest'
test('Server started successfully', async () => {
async function startServer() {
Expand Down Expand Up @@ -788,10 +788,9 @@ This is similar to `vi.waitFor`, but if the callback throws any errors, executio
Look at the example below. We can use `vi.waitUntil` to wait for the element to appear on the page, and then we can do something with the element.

```ts
import { test, vi } from 'vitest'
import { expect, test, vi } from 'vitest'
test('Element render correctly', async () => {
const element = await vi.waitUntil(
() => document.querySelector('.element'),
{
Expand Down

0 comments on commit 833a46d

Please sign in to comment.