Comments (32)
The source map error can be safely ignored. Sorry, but I don't know why it cannot find the test suite. I cannot reproduce this error on my Windows machine. If you're interested, contributions are welcome
from vscode.
I will keep digging but running the extension locally I can get it to work I think
But very interestingly when I run the tests in debug mode:
The tests fail with the familiar text:
And in the terminal, the first error appears as before Could not read source map for file...
but the tests parse
from vscode.
@mengqianyixing @zxch3n are either of you using nvm
?
I am and I wonder if that's at all a contributor?
from vscode.
I got this when I first tried to use the extension as well. The solution for me was to use the following setting to have my package manager run the test instead of whatever the extension was trying to do to locate the correct command:
In my case, pnpm vitest
was the correct setting. But yours may be different, depending on the package manager you're using and what it's cli is for using installed binaries.
from vscode.
pnpm
didn't help; I'm still having this error.
Not sure if this debugging helps:
from vscode.
I got this when I first tried to use the extension as well. The solution for me was to use the following setting to have my package manager run the test instead of whatever the extension was trying to do to locate the correct command:
In my case,
pnpm vitest
was the correct setting. But yours may be different, depending on the package manager you're using and what it's cli is for using installed binaries.
it's still not work by use 'pnpm vitest', look like the "vitest" it's not good support for the windows. :)
from vscode.
@mengqianyixing
I got this when I first tried to use the extension as well. The solution for me was to use the following setting to have my package manager run the test instead of whatever the extension was trying to do to locate the correct command:
In my case,pnpm vitest
was the correct setting. But yours may be different, depending on the package manager you're using and what it's cli is for using installed binaries.it's still not work by use 'pnpm vitest', look like the "vitest" it's not good support for the windows. :)
For what it's worth, I'm on windows as well. And it's working for me. So I'm guessing windows isn't the root of your problem.
from vscode.
@mengqianyixing Is this still happening on v0.1.17?
from vscode.
We still have the problem in v0.1.17 (On windows, with NPM)
from vscode.
@AlmarAubel Is your env.PATH equal to undefined
as well? If so, how about setting vitest.nodeEnv to {PATH: "/path/to/node"}
from vscode.
yes env.PATH: undefined
Tried to set vitest.nodeEnv to "vitest.nodeEnv": {"PATH":"C:\Program Files\nodejs\" }. But keep having the same error.
When i debug a test I get this error:
Some breakpoints might not work in your version of Node.js. We recommend upgrading for the latest bug, performance, and security fixes. Details: [https://aka.ms/AAcsvqm]()
"[C:\Program]() Files\nodejs\node.exe" [.\node_modules\vitest\vitest.mjs]() run /source/xxxxx/AdresField.test.ts --testNamePattern "Adressfield should render" --reporter=default --reporter=json --outputFile [C:\Users\Almar\AppData\Local\Temp\vitest-report-4m0912.json]()
RUN v0.9.3 [c:/source/xxxx]()
node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008
Could not read source map for [file:///c:/source/xxxxx/@vite/env](): ENOENT: no such file or directory, open '[c:\source\xxxx\]()@vite\env.mjs.map'
This give me the same error "vitest.nodeEnv": {"PATH":"C:\Program Files\nodejs\node.exe" }
from vscode.
@AlmarAubel Can you try "vitest.nodeEnv": {"PATH":"C:\\Program Files\\nodejs\\" }
from vscode.
Still the Same error.
Don't have much time today if you like I could debug and try to make a PR later this week to fix this issue for windows.
Running the command from the error message directly in the terminal give no errors:
node c:\source\xxxx\node_modules\vitest\vitest.mjs /source/xxxxx/libs/shared/src/components/form-elements/AdresField/AdresField.test.ts --reporter=json --reporter=verbose --outputFile "C:/Users/xxx/AppData/Local/Temp/vitest-report-ggr50.json" --run -t Adressfield
from vscode.
Thanks! @AlmarAubel
from vscode.
Is this still happening on v0.1.18? @mengqianyixing @xon52
from vscode.
@zxch3n same error with additional lines in blue:
from vscode.
@xon52 this looks like another issue. Do you use a dynamic test name or it.each
in AnimatedLetter.test.ts
?
Have you met the error with Vitest should be configured to be able to run from project root
?
from vscode.
I get this for all my tests, and no, nothing fancy at all. This has never worked, even boilerplate.
If I run vitest
from the normal script method in the terminal it works fine.
from vscode.
@xon52 If you run the test with the plugin, would you see an error like this one?
from vscode.
All green from terminal/script method:
from vscode.
@AlmarAubel Hi, can you debug successfully? I wonder whether you have met the same problem.
@xon52 yes, I use nvm. But I'm not sure what's the course of debugging result not found error.
I am and I wonder if that's at all a contributor?
Sorry, I don't know what you mean here
from vscode.
Oh ok. I was wondering if there was something strange with the Node path because of nvm.
And I meant cause contributor not GitHub contributor
from vscode.
I believe my PR will fix this issue (at least at my machine ;)) @zxch3n can you verify that it's also working on your machine?
Otherwhise we have to change the comparison so it’s not case sensitive on windows when comparing file paths
from vscode.
@xon52 could you check should be fixed in v0.1.18
from vscode.
@AlmarAubel still not working for me. I did fix normal Run mode with this Draft PR: #24
But I haven't finished on the Debug mode.
Please could you pull and test if it works on your machine?
from vscode.
Did you still have de node env setting set in your workspace settings?
from vscode.
from vscode.
Hey, I experienced "( Vitest should be configured to be able to run from project root )"
on macOS as well. What helped in my case was running VSCode from the project root (code .
). For example running VSCode from an app launcher provokes the error again.
Maybe this helps :)
from vscode.
I am also getting this error in debug, though it passes, the test keeps running and doesn't complete. If I get it to stop, it shows it passed.
"C:\Program Files\WindowsPowerShell\Modules\nvm\2.5.1\vs\v16.14.2\node.exe" .\node_modules\vitest\vitest.mjs run tests/Basic.spec.tsx --testNamePattern "Test Basic" --reporter=default --reporter=json --outputFile C:/Users/USER/AppData/Local/Temp/vitest-report-hpuz2.json RUN v0.9.3 c:/Users/USER/source/repos/REPO node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008 Could not read source map for file:///c:/Users/USER/source/repos/REPO/@vite/env: ENOENT: no such file or directory, open 'c:\Users\USER\source\repos\REPO\@vite\env.mjs.map' √ tests/input/Basic.spec.tsx (15 tests | 14 skipped) 615ms node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008 Test Files 1 passed (1) node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008 Tests 1 passed | 14 skipped (15) node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008 Time 27.05s (in thread 615ms, 4398.58%) node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008 JSON report written to C:/Users/USER/AppData/Local/Temp/vitest-report-hpuz2.json node_modules/vitest/dist/chunk-vite-node-externalize.9aaddc2d.js:13008 close timed out after 1000ms
from vscode.
I have the same problem as described by @darkgrayknight when I use the debugging functionality in the VSCode extension. In addition, this is the underlying error:
Error: Cannot find module 'vite'
Require stack:
- e:\repos\project\vite.config.js
- E:\repos\project\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-8f5c9290.js
- E:\repos\project\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\index.js
at Function.Module._resolveFilename (e:\repos\project\lib\internal\modules\cjs\loader.js:933:15)
at Function.Module._load (e:\repos\project\lib\internal\modules\cjs\loader.js:778:27)
at Module.require (e:\repos\project\lib\internal\modules\cjs\loader.js:1005:19)
at require (e:\repos\project\lib\internal\modules\cjs\helpers.js:102:18)
at Object.<anonymous> (e:\repos\project\vite.config.js:25:19)
at Module._compile (e:\repos\project\lib\internal\modules\cjs\loader.js:1105:14)
at Object.require.extensions.<computed> [as .js] (E:\repos\project\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:61963:20)
at Module.load (e:\repos\project\lib\internal\modules\cjs\loader.js:981:32)
at Function.Module._load (e:\repos\project\lib\internal\modules\cjs\loader.js:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {code: 'MODULE_NOT_FOUND', requireStack: Array(3), stack: 'Error: Cannot find module 'vite'
Require stac…re (node:internal/modules/cjs/loader:1005:19)', message: 'Cannot find module 'vite'
Require stack:
- e…@2.9.12\node_modules\vite\dist\node\index.js'}
Maybe you can look into this and reopen the issue in the meanwhile @zxch3n ?
Thank you!
from vscode.
@itpropro I publish a new version to pre-release just now, v0.2.18. Can you check whether this is still happening?
from vscode.
@itpropro I publish a new version to pre-release just now, v0.2.18. Can you check whether this is still happening?
All my problems are fixed since 2.16/17, thanks for the effort :)
from vscode.
Related Issues (20)
- vitest version not detected with nvm and pnpm HOT 1
- Debugger command missing vitest command HOT 4
- Publish updates to Open VSX Registry HOT 1
- Vitest version = undefined HOT 13
- Incorrect path in debug mode
- commandLine setting ignored HOT 3
- Automatically open browser when running tests HOT 4
- tests spinning forever and output shows test not found HOT 6
- ignores get .env.local variables HOT 2
- Running vitest from status bar changes workspace setting `"testing.automaticallyOpenPeekView": "never"` HOT 2
- Test name should be wrapped in quotes for mac HOT 1
- Support `vitest.rootPath` option HOT 2
- Bug "NaN%, 2 skipped" HOT 1
- Since vitest 0.30 : SyntaxError: Cannot use import statement outside a module when running tests HOT 5
- Test should NOT be launched in Source Control Tree View
- server.https setting breaks functionality HOT 3
- Bug: first run error HOT 1
- Does not support vitest 0.29 or newer on Windows HOT 4
- Slows everything down HOT 1
- Doesn't support creating `test`s with `forEach` loop HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode.