-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Load coverage packages from the same place where Vitest package is located #6542
Comments
Please use the bug report template for issues that are clearly bugs. |
Hello @leduyquang753. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with |
Reproduction steps:
import {test} from "vitest";
test("Test", () => {});
|
It is using Vitest in directory A, otherwise
It appears your setup has directory B as a subdirectory of directory A; it does also work on my machine. So it seems the issue only comes up when the two directories are totally separate. To make sure here is a
It doesn't, that was in fact what initially uncovered this issue. |
Oh sorry, I missed this part. Yes, it should be using the Vitest from that directory then. Feel free to debug this further. The loading happens around here:
|
Clear and concise description of the problem
Currently, when Vitest is run with
root
set to elsewhere, or when it is run as a global package, the target project has to have the desired coverage package be installed, or this error occurs:Notably, Vitest doesn't prompt to install such coverage package in this case.
This causes difficulties when trying to make use of Vitest as a global tool or for testing external projects.
Suggested solution
Try to load such coverage packages from the same place where the Vitest package is installed, which is either the global or the current directory's
node_modules
folder, instead of the target project's.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: