From df1312719887af6a89630a0e6bbd58a0da0629d7 Mon Sep 17 00:00:00 2001 From: adrienbaron Date: Fri, 30 Dec 2022 13:46:31 +0000 Subject: [PATCH] fix: read package.json to check if a folder is a Vitest env --- src/pure/isVitestEnv.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pure/isVitestEnv.ts b/src/pure/isVitestEnv.ts index d76f1e80..14603663 100644 --- a/src/pure/isVitestEnv.ts +++ b/src/pure/isVitestEnv.ts @@ -53,8 +53,8 @@ export async function mayBeVitestEnv(projectRoot: string | WorkspaceFolder): Pro return false const pkgPath = path.join(projectRoot, 'package.json') as string - const pkg = JSON.parse(await readFile(pkgPath, 'utf-8')) as any - if (existsSync(pkg)) { + if (existsSync(pkgPath)) { + const pkg = JSON.parse(await readFile(pkgPath, 'utf-8')) as any if (pkg.devDependencies && pkg.devDependencies.vitest) return true