/
worker.ts
34 lines (30 loc) · 928 Bytes
/
worker.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { MessagePort } from 'node:worker_threads'
import type { Test } from '@vitest/runner'
import type { ModuleCacheMap, ViteNodeResolveId } from 'vite-node'
import type { BirpcReturn } from 'birpc'
import type { MockMap } from './mocker'
import type { ResolvedConfig } from './config'
import type { ContextRPC, RuntimeRPC } from './rpc'
export interface WorkerContext extends ContextRPC {
workerId: number
port: MessagePort
}
export type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>
export interface AfterSuiteRunMeta {
coverage?: unknown
}
export interface WorkerGlobalState {
ctx: WorkerContext
config: ResolvedConfig
rpc: BirpcReturn<RuntimeRPC>
current?: Test
filepath?: string
environmentTeardownRun?: boolean
isCancelling?: boolean
moduleCache: ModuleCacheMap
mockMap: MockMap
durations: {
environment: number
prepare: number
}
}