Closed jd1378 closed 1 month ago
Well It seems the error is happening in my source code somewhere when it's running app.use(serveStatic(app.get('public')))
,
which seems to get some config, and that config is not loaded
and it seems the reason is that the working directory of the extension is not at the project, but somewhere in vscode folder in appdata
what can I do to set working directory to my project ?
I'm getting the same problem. This happens because you are rerunning the tests too quickly after changing the test file. You'll have to wait a bit, 5 seconds or so, after changing the file. I can reproduce this everytime if rerunning quickly after changing test files.
This might be a Windows only issue though.
This might be windows only, but the problem is not being too quickly, it outright crashes, because the working directory is set to somewhere other than the project
Yes I've also observed the cwd being incorrect which caused my test suite to fail. I could bypass that issue by finding the correct project folder by traversing backwards from __dirname
but it's not elegant. For me, when I rerun the tests quickly after changing the test file, the test looks like they are running because a small loader appears in the top of the test explorer pane, but no test actually runs I think, because no console logs are recorded. I've never had vscode outright crash on me though.
I would suggest this is not a minor bug.
The same thing happens while running pnpm dev in sveltekit project and when hmr reloads a file eg:
src/routes/api/someroute/[id]/+page.server.ts
The extension crashes with an error saying: 'src/routes/api/someroute/[id]/+page.server.ts' is not available. Then it just hangs. No way of resetting or restarting. The only way is to close vscode and reopen. It's very annoying, and basically makes the extension unusable. So hence my suggestion this is NOT a minor bug.
You end up being stuck with spinner and "Resolving Vitest" and no way to "hard reset" or do something. Surely that must be an option?
Full output of the error:
Error: ENOENT: no such file or directory, open 'src/routes/app/someroute/[id]/+page.server.ts'
at Object.readFileSync (node:fs:453:20)
at createProxy (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js:519:31)
at ensureProxies (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js:505:20)
at process_node (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js:380:2)
at update_types (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js:250:7)
at write_types (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js:150:2)
at Module.update (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/core/sync/sync.js:48:8)
at file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:317:8
at FSWatcher.<anonymous> (file:///project/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@4.2.17_vite@5.2.12_@types+node_kksg7dl7df63ve4rt7ijxpt6ti/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:291:5)
at FSWatcher.emit (node:events:530:35) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'src/routes/app/someroute/[id]/+page.server.ts'
}
I need some kind of reproduction that I can install and run to see the error by myself.
Then it just hangs. No way of resetting or restarting. The only way is to close vscode and reopen.
There is a "Refresh" button that should work:
If it doesn't, I will need a reproduction to see why.
The potential fix is released in v0.11.0 - this is a pre-release version and you might need to enable it manually:
Please let me know if it fixes your issue.
thanks a lot for the quick fix it seems to be working for me
This should be fixed for everyone in 0.12.0.
Describe the bug
In Testing panel of vscode vitest throws
AssertionError [ERR_ASSERTION]: root directory is required to serve files
after saving a file. extension works correctly when vscode is opened for the first time and nothing is changed in files yet.I wish I could create a reproduction, but I can't
the only thing I'm noticing is in the logs it's missing the last letter of the path:
test/client.test.t
Reproduction
Output
Version
v0.10.7
Validations