Skip to content

Commit 46b13f6

Browse files
authored
perf: get workerId from a global object (#8507)
1 parent 41cbc53 commit 46b13f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/vitest/src/runtime/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { ContextRPC, WorkerGlobalState } from '../types/worker'
33
import type { VitestWorker } from './workers/types'
44
import { pathToFileURL } from 'node:url'
55
import { createStackString, parseStacktrace } from '@vitest/utils/source-map'
6-
import { workerId as poolId } from 'tinypool'
76
import { EvaluatedModules } from 'vite/module-runner'
87
import { loadEnvironment } from '../integrations/env/loader'
98
import { addCleanupListener, cleanup as cleanupWorker } from './cleanup'
@@ -40,6 +39,7 @@ async function execute(method: 'run' | 'collect', ctx: ContextRPC) {
4039
const cleanups: (() => void | Promise<void>)[] = [setupInspect(ctx)]
4140

4241
process.env.VITEST_WORKER_ID = String(ctx.workerId)
42+
const poolId = process.__tinypool_state__?.workerId
4343
process.env.VITEST_POOL_ID = String(poolId)
4444

4545
let environmentLoader: ModuleRunner | undefined

0 commit comments

Comments
 (0)