Skip to content

Commit

Permalink
fix: consider workspace folder with no package.json not vitest env
Browse files Browse the repository at this point in the history
  • Loading branch information
evanandrewrose authored and zxch3n committed Jun 18, 2022
1 parent 690a880 commit be4d4c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pure/isVitestEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export async function isVitestEnv(projectRoot: string | WorkspaceFolder): Promis
if (getVitestPath(projectRoot))
return true

if (!existsSync(path.join(projectRoot, 'package.json')))
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)) {
Expand Down

0 comments on commit be4d4c3

Please sign in to comment.