-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
"Test result not found" for all tests #47
Comments
Can you change the setting to |
I changed the workspace config to {
"vitest.commandLine": "yarn test --",
"vitest.enable": true
} unfortunately, without any change in behavior. With the referenced repository using yarn (there was no lock file, so I used yarn) I have the same problem: EDIT: Here is the debug output
|
Ok, I think I have figured something out. It is definitely connected to using |
Unfortunately, moving my main project from yarn to pnpm didn't fix the problem, I still get the same "Test not found' error, but now I get this one in addition from time to time:
|
Thanks. I'll look into it |
Hi have the same issue, Im waiting for news, thanks! |
I had the same issue and while I was trying to resolve it vitest 0.15.0 was released so I upgraded figuring that might resolve the issue and now I'm receiving the following error exclusively when running my vitest through the vitest VSCode extension:
Again this only happens when running the test through the VSCode extension after upgrading vitest to 0.15.0. Before upgrading to 0.15.0, I received the same error as what was originally posted. I am using npm as a package manager, not yarn. My test:
|
@zxch3n been a while but back in Vue and having this same issue again. It appears if I use any variables in the test name the VSCode Ext fails for that. Running |
@xon52 dynamic test name is not supported yet |
@juananmuxed @TimFeldmann-Patriot @itpropro Can you check whether the pre-release version works now? @xon52 now dynamic test name is partially supported in the pre-release version, but you need to run from its parent describe block/file. |
@zxch3n I just tested the newest version (0.2.14), but the tests are just stuck in the VSCode pane forever like this:
Just for testing, I updated to the most current vitest version, but the tests in VSCode are still stuck forever. |
@itpropro I published a new version to pre-release (v0.2.15) that fixed the run forever issue. Can you check whether it works now? |
Hey @zxch3n, it works now 😀 Thank you so much for troubleshooting and fixing this, keep up the great work! |
Hey! I'm checking and I have the same error
I have the latest version Nothing weird in the test: {
environment: "jsdom",
coverage: {
reporter: ["text", "json", "html"],
},
}, |
@juananmuxed Can you switch to the pre-release version (v0.2.18) to test it again? |
I'm facing the same issue but I assume the reason is that we use a monorepo for our frontend and backend. I open vscode with the root directory so there is no package.json or any of the config files in the root directory but instead in one directory deeper (./frontend/package.json etc.) When I open the project directly in the frontend directory it properly recognizes that there is vitest in place and the tests also run as expected (without the result not found error). I think it would be nice to be able to configure this in the workspace (e.g. rootDir: "./frontend") or maybe let the extension check sub directories? |
Still not working A simple mount render import { describe, it, expect } from "vitest";
import { mount } from "@vue/test-utils";
import FooterVue from "../footer/Footer.vue";
describe("Footer", () => {
describe("Props", () => {
it("Default", async () => {
const wrapper = mount(FooterVue);
expect(wrapper).toMatchSnapshot();
});
});
}); Result:
|
@btmnk mono repo is not supported yet #6 #13 . As a workaround, you can use it with VSCode workspaces now, thanks to @evanandrewrose . |
@juananmuxed Can you post the extension output? You can find it here, thanks |
@kingyue737 Can you post the output from 'vitest' as well? |
@juananmuxed Sorry, I don't know what caused your error. Can you reproduce it in https://github.com/zxch3n/vitest-ext-basic-example ? |
Output:
|
I had this issue, what I did was updating both vue and vitest to the latest version and reloaded vscode window. Now I'm on: "vitest": "^0.16.0", |
Sorry for late response.
Following all in the repo |
I don't know why this issue was closed, I've updated to the latests versions (vitest .16.0, vitest extension: 0.2.19 ) and to find the right combination of settings that make this work is a torture. I would help a lot that the extension has some debug mode or something that spits info to help debugging. Apart from the versions, there seems to be these factors into play:
In my case, I have Windows, node with nvm, npm. I start with powershell I have in my my package json
so that running in my terminal
runs the test as expected (the latter in watch mode) However the setting
(it's strange the stdout | unknown test bit) and the setting
(in watch mode) simply hangs everythiong. The test ouptut terminal shows
and the inprogres indicators (spinner, "Running tests messages") go forever. Restart required. I try instead
... and now it works. Don't know why Ok. Now I want to switch to my preferred terminal: bash from git in windows. I follow the recipe here And now I'm back to the "Test result not found" error
|
having the same "Test not found" issues with npm, running pre-release |
There’s a common error when running with a nested multi-root workspace (i.e. The extension then picks up on a successful & a failing/misconfigured test result, and gets confused. You can see this if you go to the Vitest section in the Output tab. The fix is simple (in your "vitest.disabledWorkspaceFolders": ["root"] Then restart VS Code. The extension doesn’t pick up on config changes until you do. @zxch3n I think this is the source of most of the errors of this kind, just judging by what people are reporting. |
I have this error even though I'm not in a mono repo. Restarting VS Code fix it sometimes. No problems in terminal.
|
This error occurs the first time the test is run; it does not occur the second or subsequent times. |
Same problem here using |
I have never been able to get this to work. I set "vitest.commandLine": "npm run test --" an "test": "npx vite" and it gives this:
if I take the exact same command
and run it, it works fine. I can't imagine what would cause this? Wrong folder? It's an absolute path. |
I'm having the same issue as @abarke but downgrading vite to 3.2.6 seems to do nothing. Only VS Code Extension fails. |
I'm having the same issue just in Windows. It works fine in WSL2. I've tried to change In WSL2, just keep My vite.config.ts is like below: test: {
// enable jest-like global test APIs
globals: true,
include: ["tests/unit/**/*.{test,spec}.{ts,js}"],
environment: "happy-dom", // or 'jsdom', 'node'
// Reference: https://vitest.dev/guide/coverage.html
coverage: {
provider: "istanbul", // or 'v8'
reporter: ["text", "html"], // , "clover", "json"
reportsDirectory: "./tests/coverage",
}, I've tried to change the extension code like below, and got a new dist/extension.js with compile, and the "No test files found" error was cleared. But, "Test result not found" is still shown... // runner.ts
const workspacePathWithSlash = sanitizeFilePath(`${this.workspacePath}/`, true)
const getRelativePath = (filePath: string) => {
if (filePath.startsWith(workspacePathWithSlash))
return filePath.substring(workspacePathWithSlash.length)
return filePath
}
const args = [
...vitestCommand.args,
...(testFile ? testFile.map(f => getRelativePath(sanitizeFilePath(f, true))) : []),
] as string[]
if (updateSnapshot)
args.push('--update') |
I'm having the same issue,but I solved it! My global node version is 14. In my project, I temporarily changed the version under the project to 16 by nvm. The extension don't work. Then I changed the global node version to be consistent with my project version, and with |
I was able to solve this by updating
And for debugging, make sure you setup the |
This issue should be reopened as it is far from resolved. This makes using |
I keep receiving the error but test do start, so I do receive both error output and correct output. That Vitest had out-of-box working debug for VSCode was the sale point when I considered switching from Jest to Vitest. |
Fixed it in my mono-repo by creating
See https://vitest.dev/guide/workspace.html Update: Additionally I run into #183 which seems to produce the |
After struggling for too long, I realised that, if there is a TypeScript compilation error, it will say "Test result not found" Make sure to:
... because it will tell you the real error |
I also head-scratched for a while until I tried to remove a yarn linked dependency. I had this error in the vscode output:
So I ran It may have been a problem on top of the others, as I kept all the previous workarounds in this thread. |
For me it was because vitest in vscode could reslove my custom set in my tsconfig.json, the CLI Oddly vitest doesnt offer any kind of hint that this was the issue. ...
resolve: {
alias: {
'@utils': resolve(__dirname, './src/utils'),
'@test': resolve(__dirname, './test'),
'@src': resolve(__dirname, './src'),
},
},
... To match my tconfig ...
"paths": {
"@test/*": ["../test/*"],
"@utils/*": ["./utils/*"],
"@src/*": ["./*"]
}
... |
@gregpalaci was it because you were using them like |
In my case, I am using a monorepo with pnpm. It was firstly not even seeing the tests. Then I have set the Edit: I have found that I can just open VS Code at the workspace directory and it just works! The initial configurations from Svelte Kit setup is enough for my case. This might be annoying for some that is working in multiple workspaces at the same time but enough for my use case. This the link to the workspace in the monorepo in case anyone wants to take a look: |
The other issue I found was you can't use variables as descriptions as mentioned #47 (comment) |
Im in a monorepo and found a possible solution: Adding an additional Here is my structure:
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
globals: true,
},
}) And we are green ✅ |
I have the same problem as in this already closed issue #8 tests are working fine on the terminal (separate or VSCode integrated) but the tests are all failing in the extension:
From testing around I found that without any configuration, the result is this
And with
"vitest.commandLine": "yarn test"
, it actually runs the test, but still displays everything as failed (probably because of the bottom part):System
vite.config.js
There is also an issue in the vitest repo:
vitest-dev/vitest#1407
The text was updated successfully, but these errors were encountered: