Skip to content

Commit

Permalink
fix: don't raise version warning if vitest is not installed yet
Browse files Browse the repository at this point in the history
  • Loading branch information
zxch3n committed Nov 19, 2022
1 parent 87c8e33 commit 744032c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ export async function getVitestWorkspaceConfigs(): Promise<VitestWorkspaceConfig
const cmd = getVitestCommand(workspace.uri.fsPath)
const isUsingVitestForSure = getConfig(workspace).enable || await isDefinitelyVitestEnv(workspace) || (!!cmd)

const version = await getVitestVersion(cmd, getConfig(workspace).env || undefined).catch(async (e) => {
log.info(e.toString())
log.info(`process.env.PATH = ${process.env.PATH}`)
log.info(`vitest.nodeEnv = ${JSON.stringify(getConfig(workspace).env)}`)
let errorMsg = e.toString()
if (!isNodeAvailable(getConfig(workspace).env || undefined)) {
log.info('Cannot spawn node process')
errorMsg += 'Cannot spawn node process. Please try setting vitest.nodeEnv as {"PATH": "/path/to/node"} in your settings.'
}

log.error(errorMsg)
return undefined
})
const version = cmd == null
? undefined
: await getVitestVersion(cmd, getConfig(workspace).env || undefined).catch(async (e) => {
log.info(e.toString())
log.info(`process.env.PATH = ${process.env.PATH}`)
log.info(`vitest.nodeEnv = ${JSON.stringify(getConfig(workspace).env)}`)
let errorMsg = e.toString()
if (!isNodeAvailable(getConfig(workspace).env || undefined)) {
log.info('Cannot spawn node process')
errorMsg += 'Cannot spawn node process. Please try setting vitest.nodeEnv as {"PATH": "/path/to/node"} in your settings.'
}

log.error(errorMsg)
return undefined
})

const disabled = getRootConfig().disabledWorkspaceFolders
const out: VitestWorkspaceConfig = cmd
Expand Down

0 comments on commit 744032c

Please sign in to comment.