We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
vitest-dev
sheremet-va
antfu
patak-dev
Learn more about funding links in repositories.
Report abuse
1 parent 44b6a38 commit a3393b1Copy full SHA for a3393b1
packages/vitest/src/node/pkg.ts
@@ -1,13 +1,16 @@
1
+import url from 'node:url'
2
import c from 'picocolors'
3
import { isPackageExists } from 'local-pkg'
4
import { EXIT_CODE_RESTART } from '../constants'
5
import { isCI } from '../utils/env'
6
7
+const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
8
+
9
export async function ensurePackageInstalled(
10
dependency: string,
11
root: string,
12
) {
- if (isPackageExists(dependency, { paths: [root] }))
13
+ if (isPackageExists(dependency, { paths: [root, __dirname] }))
14
return true
15
16
const promptInstall = !isCI && process.stdout.isTTY
0 commit comments