Skip to content

Commit 60bce3f

Browse files
committed
Merge branch 'main' of github.com:vitest-dev/vitest into feat/disable-colors-for-agents
2 parents 80a87ab + 1bc3e63 commit 60bce3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1921
-378
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body:
1919
id: reproduction
2020
attributes:
2121
label: Reproduction
22-
description: Please provide a link to [StackBlitz](https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/) (you can also use [examples](https://github.com/vitest-dev/vitest/tree/main/examples)) or a github repo that can reproduce the problem you ran into. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required unless you are absolutely sure that the issue is obvious and the provided information is enough to understand the problem. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed.
22+
description: Please provide a link to a github repository that can reproduce the problem you ran into (feel free to clone one of the [examples](https://github.com/vitest-dev/vitest/tree/main/examples)). You can also use [StackBlitz](https://stackblitz.com/fork/github/vitest-dev/vitest/tree/main/examples/basic?initialPath=__vitest__/) if it works. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is always required no matter how easy it is to understand the problem. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed.
2323
placeholder: Reproduction
2424
validations:
2525
required: true

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223

224224
- name: Install
225225
run: |
226-
yq -i '.overrides.vite = "npm:vite@beta"' pnpm-workspace.yaml
226+
yq -i '.overrides.vite = "npm:vite@8"' pnpm-workspace.yaml
227227
git add . && git commit -m "ci" && pnpm i --prefer-offline --no-frozen-lockfile
228228
229229
- uses: ./.github/actions/setup-playwright

docs/.vitepress/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ export default ({ mode }: { mode: string }) => {
135135
}, */
136136
},
137137

138+
banner: {
139+
id: 'viteplus-alpha',
140+
text: 'Announcing Vite+ Alpha: Open source. Unified. Next-gen.',
141+
url: 'https://voidzero.dev/posts/announcing-vite-plus-alpha?utm_source=vitest&utm_content=top_banner',
142+
},
143+
138144
carbonAds: {
139145
code: 'CW7DVKJE',
140146
placement: 'vitestdev',

docs/api/browser/locators.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ The locator API uses a fork of [Playwright's locators](https://playwright.dev/do
1313
This page covers API usage. To better understand locators and their usage, read [Playwright's "Locators" documentation](https://playwright.dev/docs/locators).
1414
:::
1515

16+
::: tip Difference from `testing-library`
17+
Vitest's `page.getBy*` methods return a locator object, not a DOM element. This makes locator queries composable and allows Vitest to retry interactions and assertions when needed.
18+
19+
Compared to testing-library queries:
20+
21+
- Use locator chaining (`.getBy*`, `.filter`, `.nth`) instead of `within(...)`.
22+
- Keep locators around and interact with them later (`await locator.click()`), instead of resolving elements up front.
23+
- Single-element escape hatches like `.element()` and `.query()` are strict and throw if multiple elements match.
24+
25+
```ts
26+
import { expect } from 'vitest'
27+
import { page } from 'vitest/browser'
28+
29+
const deleteButton = page
30+
.getByRole('row')
31+
.filter({ hasText: 'Vitest' })
32+
.getByRole('button', { name: /delete/i })
33+
34+
await deleteButton.click()
35+
await expect.element(deleteButton).toBeEnabled()
36+
```
37+
:::
38+
1639
## getByRole
1740

1841
```ts

0 commit comments

Comments
 (0)