-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
windows drive casing causes - TypeError: Cannot read properties of undefined (reading 'test') #5251
Comments
Note that while adding |
I've also lost several hours because of this. In my case, my
in a seemingly random way (it worked inside a VsCode cmd terminal, but not in my plain cmd terminal) It think that it would be good practice to FAIL FAST here: I've check that the callers to getCurrentSuite() never expect to get undefined, hence, it should inside throw a descriptive error (and perhaps, if inside windows, warn about drive letter in lowercase?). I bet, for example, that #5401 (close for comments) is related to this, |
…drive letter Fixes vitest-dev#5772 Fixes vitest-dev#5798 Fixes vitest-dev#5251
…drive letter Fixes vitest-dev#5772 Fixes vitest-dev#5798 Fixes vitest-dev#5251
Describe the bug
When adding vitest to an existing project & all tests are failing with TypeError: Cannot read properties of undefined (reading 'test').
Looks like this is due to my windows cmd line having a lower-case drive letter. Tests successfully run in powershell, & vs code console.
Adding a
vitest.config.ts
file w/ a normalizedroot
property worked around the issue.Below is the stack from the
test
exception getting thrown - note the varying drive letters:Reproduction
Using the default example on StackBlitz
Download to a local folder on windows - i.e.
C:\repro\vitest-repro
.From a windows cmd line (not powershell or vs code console), make sure your drive prompt is lower-case.
cd c:\repro\vitest-repro
Run tests
If you add a vitest.config.ts w/ the
root
property as above, it resolvesSystem Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: