Skip to content

Commit

Permalink
fix: don't panic when vitest is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jan 23, 2025
1 parent d69ab49 commit 1905de2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ export function resolveVitestPackagePath(cwd: string, folder: vscode.WorkspaceFo
if (customPackagePath && !customPackagePath.endsWith('package.json'))
throw new Error(`"vitest.vitestPackagePath" must point to a package.json file, instead got: ${customPackagePath}`)
try {
return customPackagePath || require.resolve('vitest/package.json', {
const result = customPackagePath || require.resolve('vitest/package.json', {
paths: [cwd],
})
delete require.cache['vitest/package.json']
delete require.cache[result]
return result
}
catch {
return null
Expand Down

0 comments on commit 1905de2

Please sign in to comment.