Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/vitest/src/typecheck/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ export async function getTsconfig(root: string, config: TypecheckConfig) {
throw new Error('no tsconfig.json found')
}

const tsconfigName = basename(tsconfig.path, '.json')
const tempTsConfigName = `${tsconfigName}.vitest-temp.json`
const tempTsbuildinfoName = `${tsconfigName}.tmp.tsbuildinfo`

const tempConfigPath = join(
dirname(tsconfig.path),
'tsconfig.vitest-temp.json',
tempTsConfigName,
)

try {
Expand All @@ -88,15 +92,15 @@ export async function getTsconfig(root: string, config: TypecheckConfig) {
tmpTsConfig.compilerOptions.incremental = true
tmpTsConfig.compilerOptions.tsBuildInfoFile = join(
process.versions.pnp ? join(os.tmpdir(), 'vitest') : __dirname,
'tsconfig.tmp.tsbuildinfo',
tempTsbuildinfoName,
)

const tsconfigFinalContent = JSON.stringify(tmpTsConfig, null, 2)
await writeFile(tempConfigPath, tsconfigFinalContent)
return { path: tempConfigPath, config: tmpTsConfig }
}
catch (err) {
throw new Error('failed to write tsconfig.temp.json', { cause: err })
throw new Error(`failed to write ${tempTsConfigName}`, { cause: err })
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/typescript/test/__snapshots__/runner.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯ Typecheck Error ⎯⎯⎯⎯⎯⎯⎯
Error: error TS18003: No inputs were found in config file '<root>/tsconfig.vitest-temp.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["**/dist/**"]'.
Error: error TS18003: No inputs were found in config file '<root>/tsconfig.empty.vitest-temp.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["**/dist/**"]'.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Expand Down
Loading