fix(typecheck): use unique temp and tsbuildinfo file for each tsconfig file (fix #7107) #7112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Context:
This PR addresses an edge case outlined in issue #7107 (which also contains a reproduction example). The issue arises when a directory contains multiple tsconfig*.json files, each corresponding to different test workspaces. Merging this may fix #7107
Example:
In this scenario, each tsconfig file is linked to a separate workspace. However, Vitest might behave undeterministically, because for each tsconfig file found in the same directory, it attempts to write to the same temporary configuration file,
tsconfig.vitest-temp.json
.This can lead to flaky test results due to broken temp tsconfig files (different content written on top of each other) or wrong config being applied.
This PR changes Vitest's temp tsconfig and tsbuildinfo files generation to be unique for each tsconfig file it encounters.
tsconfig.json
temp config:
tsconfig.vitest-temp.json
tsbuildinfo:
tsconfig.tmp.tsbuildinfo
tsconfig.noStrict.json
temp config:
tsconfig.noStrict.vitest-temp.json
tsbuildinfo:
tsconfig.noStrict.tmp.tsbuildinfo
This change doesn't really introduce any new functionality, but helps ensure consistency in test behavior. As part of this change, I updated a test snapshot.
If there's something that I missed, please let me know.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.