Skip to content

Commit

Permalink
fix(vitest): also check for vite relative to vitest package (#3274)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>
  • Loading branch information
JoshuaKGoldberg and sheremet-va authored May 3, 2023
1 parent 44b6a38 commit a3393b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vitest/src/node/pkg.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import url from 'node:url'
import c from 'picocolors'
import { isPackageExists } from 'local-pkg'
import { EXIT_CODE_RESTART } from '../constants'
import { isCI } from '../utils/env'

const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

export async function ensurePackageInstalled(
dependency: string,
root: string,
) {
if (isPackageExists(dependency, { paths: [root] }))
if (isPackageExists(dependency, { paths: [root, __dirname] }))
return true

const promptInstall = !isCI && process.stdout.isTTY
Expand Down

0 comments on commit a3393b1

Please sign in to comment.