···173173174174export type Procedure = (...args: any[]) => any
175175// pick a single function type from function overloads, unions, etc...
176176-export type NormalizedProcedure<T extends Procedure | Constructable> = T extends Constructable
176176+type NormalizedProcedure<T extends Procedure | Constructable> = T extends Constructable
177177 ? ({
178178 new (...args: ConstructorParameters<T>): InstanceType<T>
179179 })
···11import type { Debugger } from 'obug'
22-import type { WorkerGlobalState } from 'vitest'
32import type { CloneOption } from './types'
43import ponyfillStructuredClone from '@ungap/structured-clone'
54import { createDebug } from 'obug'
6576export const debug: Debugger = createDebug('vitest:web-worker')
88-99-export function getWorkerState(): WorkerGlobalState {
1010- // @ts-expect-error untyped global
1111- return globalThis.__vitest_worker__
1212-}
137148export function assertGlobalExists(name: string): void {
159 if (!(name in globalThis)) {
-6
packages/browser-playwright/src/commands/utils.ts
···1111 [K in keyof T]: ConvertElementToLocator<T[K]>;
1212}
13131414-export function defineBrowserCommand<T extends unknown[]>(
1515- fn: BrowserCommand<T>,
1616-): BrowserCommand<T> {
1717- return fn
1818-}
1919-2014// strip iframe locator part from the trace description e.g.
2115// - locator('[data-vitest="true"]').contentFrame().getByRole('button')
2216// ⇓
+2-2
packages/browser/src/client/utils.ts
···55import type { CommandsManager } from './tester/tester-utils'
66import type { BrowserTraceAttempt } from './tester/trace'
7788-export async function importId(id: string): Promise<any> {
88+async function importId(id: string): Promise<any> {
99 const name = `/@id/${id}`.replace(/\\/g, '/')
1010 return getBrowserState().wrapModule(() => import(/* @vite-ignore */ name))
1111}
12121313-export async function importFs(id: string): Promise<any> {
1313+async function importFs(id: string): Promise<any> {
1414 const name = `/@fs/${id}`.replace(/\\/g, '/')
1515 return getBrowserState().wrapModule(() => import(/* @vite-ignore */ name))
1616}
-2
packages/browser/src/node/plugin.ts
···77import { distRoot } from './constants'
88import BrowserContext from './plugins/pluginContext'
991010-export type { BrowserCommand } from 'vitest/node'
1111-1210export default (contribution: BrowserServerContribution): Plugin[] => {
1311 return [
1412 {
+1-1
packages/browser/src/node/rpc.ts
···481481 * Replacer function for serialization methods such as JS.stringify() or
482482 * flatted.stringify().
483483 */
484484-export function stringifyReplace(key: string, value: any): any {
484484+function stringifyReplace(key: string, value: any): any {
485485 if (value instanceof Error) {
486486 const cloned = cloneByOwnProperties(value)
487487 return {
···1919 }
2020}
21212222-export function rpc(): BrowserRPC {
2222+function rpc(): BrowserRPC {
2323 return getWorkerState().rpc as any as BrowserRPC
2424}
-8
packages/browser/src/client/tester/rpc.ts
···24242525const promises = new Set<Promise<unknown>>()
26262727-export async function rpcDone(): Promise<unknown[] | undefined> {
2828- if (!promises.size) {
2929- return
3030- }
3131- const awaitable = Array.from(promises)
3232- return Promise.all(awaitable)
3333-}
3434-3527export function createSafeRpc(
3628 client: VitestBrowserClient,
3729): VitestBrowserClient['rpc'] {