Skip to content

Commit 791cb5b

Browse files
authored
feat!: support new Vitest 4 syntax (#28)
1 parent 2b6eea8 commit 791cb5b

8 files changed

Lines changed: 674 additions & 521 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Render React components in Vitest Browser Mode. This library follows `testing-li
44

55
`vitest-browser-react` aims to deliver a good developer experience in Vitest Browser Mode by incorporating the [locators API](https://vitest.dev/guide/browser/locators.html) and [retry-ability](https://vitest.dev/guide/browser/assertion-api.html) mechanism directly into the `render` result. This allows you to call user methods without needing to verify the element's existence or wait for external events (like API calls) to render the element.
66

7-
Requires `vitest` and `@vitest/browser` 2.1.0 or higher.
7+
Requires `vitest` 4.0.0 or higher.
88

99
```tsx
1010
import { render } from 'vitest-browser-react'
@@ -49,8 +49,7 @@ export default defineConfig({
4949
test: {
5050
setupFiles: ['./setup-file.ts'],
5151
browser: {
52-
name: 'chromium',
53-
enabled: true,
52+
// ... your config
5453
},
5554
},
5655
})
@@ -61,7 +60,7 @@ import 'vitest-browser-react'
6160
```
6261

6362
```tsx
64-
import { page } from '@vitest/browser/context'
63+
import { page } from 'vitest/browser'
6564

6665
test('counter button increments the count', async () => {
6766
const screen = await page.render(<Component count={1} />)

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"./pure": {
3030
"types": "./dist/pure.d.ts",
3131
"default": "./dist/pure.js"
32-
}
32+
},
33+
"./package.json": "./package.json"
3334
},
3435
"main": "./dist/index.js",
3536
"module": "./dist/index.js",
@@ -39,9 +40,6 @@
3940
"*.mjs",
4041
"dist"
4142
],
42-
"engines": {
43-
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
44-
},
4543
"scripts": {
4644
"build": "tsup",
4745
"dev": "tsup --watch --sourcemap",
@@ -54,10 +52,9 @@
5452
"peerDependencies": {
5553
"@types/react": "^18.0.0 || ^19.0.0",
5654
"@types/react-dom": "^18.0.0 || ^19.0.0",
57-
"@vitest/browser": "^2.1.0 || ^3.0.0 || ^4.0.0-0",
5855
"react": "^18.0.0 || ^19.0.0",
5956
"react-dom": "^18.0.0 || ^19.0.0",
60-
"vitest": "^2.1.0 || ^3.0.0 || ^4.0.0-0"
57+
"vitest": "^4.0.0-0"
6158
},
6259
"peerDependenciesMeta": {
6360
"@types/react": {
@@ -72,18 +69,18 @@
7269
"@types/react": "^19.0.0",
7370
"@types/react-dom": "^19.0.0",
7471
"@vitejs/plugin-react": "^4.3.3",
75-
"@vitest/browser": "^3.1.0",
72+
"@vitest/browser-playwright": "^4.0.0-beta.15",
7673
"bumpp": "^9.4.2",
7774
"changelogithub": "^0.13.9",
7875
"eslint": "^9.8.0",
79-
"playwright": "^1.46.0",
76+
"playwright": "^1.55.1",
8077
"react": "^19.0.0",
8178
"react-aria-components": "^1.10.1",
8279
"react-dom": "^19.0.0",
8380
"tsup": "^8.2.4",
8481
"tsx": "^4.17.0",
8582
"typescript": "^5.5.4",
86-
"vitest": "^3.1.0",
83+
"vitest": "^4.0.0-beta.15",
8784
"zx": "^8.1.4"
8885
}
8986
}

0 commit comments

Comments
 (0)