Skip to content

Commit

Permalink
fix: avoid dynamic require in the extension
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Oct 8, 2024
1 parent 61b37b9 commit 14eedaa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/worker/worker.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import v8 from 'node:v8'
import { WebSocket } from 'ws'
import { createWorkerRPC } from './rpc'
import type { WorkerRunnerOptions } from './types'
import { Vitest } from './vitest'
import { initVitest } from './init'
import { WorkerProcessEmitter, WorkerWSEventEmitter } from './emitter'

const _require = require

const emitter = process.env.VITEST_WS_ADDRESS
? new WorkerWSEventEmitter(new (_require('ws').WebSocket)(process.env.VITEST_WS_ADDRESS))
? new WorkerWSEventEmitter(new WebSocket(process.env.VITEST_WS_ADDRESS))
: new WorkerProcessEmitter()

emitter.on('message', async function onMessage(message: any) {
Expand Down

0 comments on commit 14eedaa

Please sign in to comment.