Skip to content

Commit

Permalink
chore: remove unused code (#6625)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Oct 3, 2024
1 parent 46be62c commit bfa64bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
11 changes: 1 addition & 10 deletions packages/vitest/src/node/pools/forks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function createForksPool(
// Cancel pending tasks from pool when possible
ctx.onCancel(() => pool.cancelPendingTasks())

const configs = new Map<WorkspaceProject, SerializedConfig>()
const configs = new WeakMap<WorkspaceProject, SerializedConfig>()
const getConfig = (project: WorkspaceProject): SerializedConfig => {
if (configs.has(project)) {
return configs.get(project)!
Expand All @@ -165,15 +165,6 @@ export function createForksPool(
return config
}

const workspaceMap = new Map<string, WorkspaceProject[]>()
for (const spec of specs) {
const file = spec.moduleId
const project = spec.project.workspaceProject
const workspaceFiles = workspaceMap.get(file) ?? []
workspaceFiles.push(project)
workspaceMap.set(file, workspaceFiles)
}

const singleFork = specs.filter(
spec => spec.project.config.poolOptions?.forks?.singleFork,
)
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/pools/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function createMethodsRPC(project: WorkspaceProject, options: MethodsOpti
return result
}
if ('id' in result && typeof result.id === 'string') {
return { id: result.id as string }
return { id: result.id }
}

if (code == null) {
Expand Down
9 changes: 1 addition & 8 deletions packages/vitest/src/node/pools/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function createThreadsPool(
// Cancel pending tasks from pool when possible
ctx.onCancel(() => pool.cancelPendingTasks())

const configs = new Map<WorkspaceProject, SerializedConfig>()
const configs = new WeakMap<WorkspaceProject, SerializedConfig>()
const getConfig = (project: WorkspaceProject): SerializedConfig => {
if (configs.has(project)) {
return configs.get(project)!
Expand All @@ -162,13 +162,6 @@ export function createThreadsPool(
return config
}

const workspaceMap = new Map<string, WorkspaceProject[]>()
for (const [project, file] of specs) {
const workspaceFiles = workspaceMap.get(file) ?? []
workspaceFiles.push(project)
workspaceMap.set(file, workspaceFiles)
}

const singleThreads = specs.filter(
spec => spec.project.config.poolOptions?.threads?.singleThread,
)
Expand Down

0 comments on commit bfa64bb

Please sign in to comment.