Skip to content

Commit 0ba64ea

Browse files
committed
patch more packages
1 parent 0df0c5f commit 0ba64ea

5 files changed

Lines changed: 221 additions & 90 deletions

File tree

packages/cli/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@
168168
"types": "./dist/test/browser-playwright.d.ts",
169169
"default": "./dist/test/browser-playwright.js"
170170
},
171+
"./test/browser-webdriverio": {
172+
"types": "./dist/test/browser-webdriverio.d.ts",
173+
"default": "./dist/test/browser-webdriverio.js"
174+
},
175+
"./test/browser-preview": {
176+
"types": "./dist/test/browser-preview.d.ts",
177+
"default": "./dist/test/browser-preview.js"
178+
},
171179
"./test/plugins/runner": {
172180
"default": "./dist/test/plugins/runner.js"
173181
},
@@ -266,6 +274,18 @@
266274
},
267275
"./test/plugins/browser-playwright-context": {
268276
"default": "./dist/test/plugins/browser-playwright-context.js"
277+
},
278+
"./test/plugins/browser-webdriverio": {
279+
"default": "./dist/test/plugins/browser-webdriverio.js"
280+
},
281+
"./test/plugins/browser-webdriverio-context": {
282+
"default": "./dist/test/plugins/browser-webdriverio-context.js"
283+
},
284+
"./test/plugins/browser-preview": {
285+
"default": "./dist/test/plugins/browser-preview.js"
286+
},
287+
"./test/plugins/browser-preview-context": {
288+
"default": "./dist/test/plugins/browser-preview-context.js"
269289
}
270290
}
271291
}

packages/test/BUNDLING.md

Lines changed: 61 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ This approach avoids the critical issue of Rolldown creating shared chunks that
1616

1717
### Copied Packages (`dist/@vitest/`)
1818

19-
These 9 `@vitest/*` packages are **copied** (not bundled) to preserve their original file structure:
20-
21-
| Package | Purpose |
22-
| ---------------------------- | ---------------------------------------------------- |
23-
| `@vitest/runner` | Test runner core |
24-
| `@vitest/utils` | Utilities (source-map, error, display, timers, etc.) |
25-
| `@vitest/spy` | Spy/mock implementation |
26-
| `@vitest/expect` | Assertion library |
27-
| `@vitest/snapshot` | Snapshot testing |
28-
| `@vitest/mocker` | Module mocking (node, browser, automock) |
29-
| `@vitest/pretty-format` | Output formatting |
30-
| `@vitest/browser` | Browser testing support |
31-
| `@vitest/browser-playwright` | Playwright integration |
19+
These 11 `@vitest/*` packages are **copied** (not bundled) to preserve their original file structure:
20+
21+
| Package | Purpose |
22+
| ----------------------------- | ---------------------------------------------------- |
23+
| `@vitest/runner` | Test runner core |
24+
| `@vitest/utils` | Utilities (source-map, error, display, timers, etc.) |
25+
| `@vitest/spy` | Spy/mock implementation |
26+
| `@vitest/expect` | Assertion library |
27+
| `@vitest/snapshot` | Snapshot testing |
28+
| `@vitest/mocker` | Module mocking (node, browser, automock) |
29+
| `@vitest/pretty-format` | Output formatting |
30+
| `@vitest/browser` | Browser testing support |
31+
| `@vitest/browser-playwright` | Playwright integration |
32+
| `@vitest/browser-webdriverio` | WebdriverIO integration |
33+
| `@vitest/browser-preview` | Preview (testing-library) integration |
3234

3335
**Why copy instead of bundle?** Bundling would create shared chunks that mix browser-safe and Node.js-only code. Copying preserves the original separation.
3436

@@ -73,6 +75,7 @@ These packages are explicitly kept external in `EXTERNAL_BLOCKLIST` during the R
7375
| Package | Reason |
7476
| ------------------ | ----------------------------------------- |
7577
| `playwright` | Native bindings, user must install |
78+
| `webdriverio` | Native bindings, user must install |
7679
| `debug` | Environment detection breaks when bundled |
7780
| `happy-dom` | Optional peer dependency |
7881
| `jsdom` | Optional peer dependency |
@@ -102,19 +105,21 @@ For maintainers developing the vitest/vite migration feature, here are the trans
102105

103106
### Import Rewrites
104107

105-
| Original Import | Rewritten Import |
106-
| ----------------------------------- | -------------------------------------------------------- |
107-
| `from "@vitest/browser-playwright"` | `from "@voidzero-dev/vite-plus-test/browser-playwright"` |
108-
| `from "vite"` | `from "@voidzero-dev/vite-plus-core"` |
109-
| `from "vite/module-runner"` | `from "@voidzero-dev/vite-plus-core/module-runner"` |
108+
| Original Import | Rewritten Import |
109+
| ------------------------------------ | --------------------------------------------------------- |
110+
| `from "@vitest/browser-playwright"` | `from "@voidzero-dev/vite-plus-test/browser-playwright"` |
111+
| `from "@vitest/browser-webdriverio"` | `from "@voidzero-dev/vite-plus-test/browser-webdriverio"` |
112+
| `from "@vitest/browser-preview"` | `from "@voidzero-dev/vite-plus-test/browser-preview"` |
113+
| `from "vite"` | `from "@voidzero-dev/vite-plus-core"` |
114+
| `from "vite/module-runner"` | `from "@voidzero-dev/vite-plus-core/module-runner"` |
110115

111-
**Note:** When using pnpm overrides, you have three options for the playwright import:
116+
**Note:** When using pnpm overrides, you have three options for browser provider imports:
112117

113-
- `vitest/browser-playwright` - works when `vitest` is overridden to our package (Recommended)
118+
- `vitest/browser-playwright` (or `vitest/browser-webdriverio`, `vitest/browser-preview`) - works when `vitest` is overridden to our package (Recommended)
114119
- `@voidzero-dev/vite-plus-test/browser-playwright` - direct import from test package
115120
- `@voidzero-dev/vite-plus/test/plugins/browser-playwright` - direct import from CLI package
116121

117-
Importing from `@vitest/browser-playwright` requires an additional override for that specific package.
122+
Importing from `@vitest/browser-*` packages directly requires additional overrides for those specific packages.
118123

119124
### package.json Changes
120125

@@ -124,7 +129,9 @@ Importing from `@vitest/browser-playwright` requires an additional override for
124129
{
125130
"devDependencies": {
126131
"@vitest/browser": "...", // Remove
127-
"@vitest/browser-playwright": "...", // Remove
132+
"@vitest/browser-playwright": "...", // Remove (if using playwright)
133+
"@vitest/browser-webdriverio": "...", // Remove (if using webdriverio)
134+
"@vitest/browser-preview": "...", // Remove (if using testing-library)
128135
"@vitest/ui": "..." // Remove (peer dep, not bundled but optional)
129136
}
130137
}
@@ -139,6 +146,8 @@ overrides:
139146
vitest: 'file:path/to/vite-plus-test.tgz'
140147
'@vitest/browser': 'file:path/to/vite-plus-test.tgz'
141148
'@vitest/browser-playwright': 'file:path/to/vite-plus-test.tgz'
149+
'@vitest/browser-webdriverio': 'file:path/to/vite-plus-test.tgz'
150+
'@vitest/browser-preview': 'file:path/to/vite-plus-test.tgz'
142151
```
143152
144153
Or using npm package names:
@@ -149,12 +158,14 @@ overrides:
149158
vitest: 'npm:@voidzero-dev/vite-plus-test'
150159
'@vitest/browser': 'npm:@voidzero-dev/vite-plus-test'
151160
'@vitest/browser-playwright': 'npm:@voidzero-dev/vite-plus-test'
161+
'@vitest/browser-webdriverio': 'npm:@voidzero-dev/vite-plus-test'
162+
'@vitest/browser-preview': 'npm:@voidzero-dev/vite-plus-test'
152163
```
153164
154165
### Config File Updates
155166
156167
```typescript
157-
// Before
168+
// Before (playwright)
158169
import { playwright } from '@vitest/browser-playwright';
159170

160171
// After - Option 1 (Recommended): Via vitest subpath (works when vitest is overridden)
@@ -167,21 +178,35 @@ import { playwright } from '@voidzero-dev/vite-plus-test/browser-playwright';
167178
import { playwright } from '@voidzero-dev/vite-plus/test/plugins/browser-playwright';
168179
```
169180

181+
Similarly for WebdriverIO:
182+
183+
```typescript
184+
import { webdriverio } from 'vitest/browser-webdriverio';
185+
```
186+
187+
And for Preview (testing-library):
188+
189+
```typescript
190+
import { preview } from 'vitest/browser-preview';
191+
```
192+
170193
### Plugin Exports for pnpm Overrides
171194

172195
The package provides `./plugins/*` exports to enable pnpm overrides for all `@vitest/*` packages:
173196

174197
```
175-
@vitest/runner -> @voidzero-dev/vite-plus-test/plugins/runner
176-
@vitest/utils -> @voidzero-dev/vite-plus-test/plugins/utils
177-
@vitest/utils/error -> @voidzero-dev/vite-plus-test/plugins/utils-error
178-
@vitest/spy -> @voidzero-dev/vite-plus-test/plugins/spy
179-
@vitest/expect -> @voidzero-dev/vite-plus-test/plugins/expect
180-
@vitest/snapshot -> @voidzero-dev/vite-plus-test/plugins/snapshot
181-
@vitest/mocker -> @voidzero-dev/vite-plus-test/plugins/mocker
182-
@vitest/pretty-format -> @voidzero-dev/vite-plus-test/plugins/pretty-format
183-
@vitest/browser -> @voidzero-dev/vite-plus-test/plugins/browser
184-
@vitest/browser-playwright -> @voidzero-dev/vite-plus-test/plugins/browser-playwright
198+
@vitest/runner -> @voidzero-dev/vite-plus-test/plugins/runner
199+
@vitest/utils -> @voidzero-dev/vite-plus-test/plugins/utils
200+
@vitest/utils/error -> @voidzero-dev/vite-plus-test/plugins/utils-error
201+
@vitest/spy -> @voidzero-dev/vite-plus-test/plugins/spy
202+
@vitest/expect -> @voidzero-dev/vite-plus-test/plugins/expect
203+
@vitest/snapshot -> @voidzero-dev/vite-plus-test/plugins/snapshot
204+
@vitest/mocker -> @voidzero-dev/vite-plus-test/plugins/mocker
205+
@vitest/pretty-format -> @voidzero-dev/vite-plus-test/plugins/pretty-format
206+
@vitest/browser -> @voidzero-dev/vite-plus-test/plugins/browser
207+
@vitest/browser-playwright -> @voidzero-dev/vite-plus-test/plugins/browser-playwright
208+
@vitest/browser-webdriverio -> @voidzero-dev/vite-plus-test/plugins/browser-webdriverio
209+
@vitest/browser-preview -> @voidzero-dev/vite-plus-test/plugins/browser-preview
185210
```
186211

187212
---
@@ -348,6 +373,8 @@ const VITEST_PACKAGES_TO_COPY = [
348373
'@vitest/pretty-format',
349374
'@vitest/browser',
350375
'@vitest/browser-playwright',
376+
'@vitest/browser-webdriverio',
377+
'@vitest/browser-preview',
351378
];
352379

353380
// Packages that must NOT be bundled (from build.ts lines 131-158)
@@ -367,6 +394,7 @@ const EXTERNAL_BLOCKLIST = new Set([
367394
// Optional dependencies with bundling issues or native bindings
368395
'debug', // environment detection broken when bundled
369396
'playwright', // native bindings
397+
'webdriverio', // native bindings
370398

371399
// Runtime deps (in package.json dependencies) - not bundled, resolved at install time
372400
'sirv',

0 commit comments

Comments
 (0)