-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bizarre tsconfig hijacking #359
Comments
This is probably the same issue as:
Since sveltekit has With this assumption, the same thing should reproduce from Vitest CLI, so I may be missing something. |
Sounds reasonable and could be a good way of solving this issue! The thick plottens. With the help of your pointer, and some more tracing, I think I'm starting to see what's going on here. What I neither knew nor expected before, but what I now believe is happening: Vitest VSCode extension:
SvelteKit
TL;DR: Mix those two together, and you seem to get the following trace:
If not already reported, I'll report the likely problematic use of One lingering question though: |
Yes, this is completely normal behaviour. The extension restarts the whole process to do it. This is also what Vitest does when root I guess what the extension should do is only react to The other thing that needs to be fixed is on the Vitest side where we should await the workspace project resolution instead of switching the CWD to the next project. |
Yeah, that's my rough guess, but I said "technically" because I'm not so confident to say this is a sveltekit bug instead of Vitest bug. As seen in the issue I linked vitest-dev/vitest#5541, there might be others plugins affected by the current behavior. For example, like sheremet-va just mentioned, Vitest could figure out the better timing to switch chdir based on how plugins commonly do weird side-effects. |
cheers for the all the added context! it's seems clearer now that this bug is not originating from the VSCode extension at all. (Apologies for the miss-attribution.) I can confirm I'm seeing the same issue running I've updated the repro to demonstrate this, independent of the IDE or IDE extension.
Yeah this could also fix this issue, and potential issues in other plugins (that use
Makes sense. I suppose whether this is a bug in SvelteKit/other-vite-plugins bug or in Vitest depends on whether you'd expect From experience I'd lean towards avoiding |
Describe the bug
We experienced some head-scratching confusion when our SvelteKit app suddenly started complaining about missing route files. After some commit and VSCode extension bisecting, we came across a bizarre behaviour that was causing SvelteKit's internal
tsconfig.json
to be overridden (seemingly by the Vitest VSCode extension) when a combination of criteria are met.Specifically, various paths in
compilerOptions.paths
andcompilerOptions.rootDirs
get updated, whenever anypackage.json
file is modified in any way, replacing those paths with invalid paths to another package (that happens to also have Vite config) in the same monorepo. This happens seemingly "magically", even when nodev
or other scripts are running.Reproduction
Repro, along with demo steps, can be found in this repo:
This repro uses SvelteKit for demoing purposes. I believe this issue is not specific to SvelteKit, however.
The issue goes away as soon as any one of the following steps are taken:
vitest.workspace.js
file, orvite.config.ts
file of sibling packages, orvitest
package at the root packageWeirder still, most of these steps will also "reset"/restore the hijacked
tsconfig.json
file to its original, expected state.Output
Version
v0.8.4
Validations
The text was updated successfully, but these errors were encountered: