-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
feat: browserIssues and PRs related to the browser runnerIssues and PRs related to the browser runnertypes
Description
Describe the bug
The '@vitest/browser-playwright' is augmenting client side types for CDP properly. However server side CDP types are not augmented.
import { playwright } from '@vitest/browser-playwright'
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
browser: {
commands: {
async interceptFetch(ctx) {
const session = await ctx.provider.getCDPSession(ctx.sessionId)
session.on('Fetch.requestPaused', async (event) => {
const url = event.request.url
// ❌ ^^^^^^^ Property 'request' does not exist on type 'unknown'
})
},
},
},
},
})Client side works correctly:
import { cdp } from "vitest/browser";
const session = cdp();
session.on("Fetch.requestPaused", async (event) => {
const url = event.request.url;
// ✅ ^^^^^^^ (property) request: Protocol.Network.Request, The details of the request.
});Reproduction
In Vitest monorepo:
System Info
Vitest monorepo, `main`Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat: browserIssues and PRs related to the browser runnerIssues and PRs related to the browser runnertypes