Skip to content
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

Extension doesn't resolve Nuxt 3 aliases #564

Open
4 tasks done
TheDutchCoder opened this issue Dec 18, 2024 · 1 comment
Open
4 tasks done

Extension doesn't resolve Nuxt 3 aliases #564

TheDutchCoder opened this issue Dec 18, 2024 · 1 comment

Comments

@TheDutchCoder
Copy link

TheDutchCoder commented Dec 18, 2024

Describe the bug

When running vitest through the extension, it will fail to resolve paths like ~/utils and other ones using ~, which is an alias that's available in Nuxt.

Running vitest in the CLI has no issues with this.

Manually adding aliasses to tsconfig or vitest's config have no effect.

Reproduction

https://github.com/TheDutchCoder/vitest-extension-bug

Output

Part of the output with the errors.

[Error 8:13:12 PM] Error in /Users/reinierkaper/rvezy/rvezy-web-client/src/utils/rv/get-rv-snapshot.vitest.spec.ts Error: Failed to load url ~/constants (resolved id: ~/constants) in /Users/reinierkaper/rvezy/rvezy-web-client/src/utils/rv/get-rv-details.ts. Does the file exist?
    at loadAndTransform (file:///Users/reinierkaper/rvezy/rvezy-web-client/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51920:17)
    at async ViteNodeServer._transformRequest (file:///Users/reinierkaper/rvezy/rvezy-web-client/node_modules/vite-node/dist/server.mjs:542:16)
    at async ViteNodeServer._fetchModule (file:///Users/reinierkaper/rvezy/rvezy-web-client/node_modules/vite-node/dist/server.mjs:504:17)
    at async Proxy.fetch (file:///Users/reinierkaper/rvezy/rvezy-web-client/node_modules/vitest/dist/chunks/resolveConfig.RxKrDli4.js:6616:22)
    at async EventEmitter.onMessage (file:///Users/reinierkaper/rvezy/rvezy-web-client/node_modules/vitest/dist/chunks/index.68735LiX.js:91:20)

Extension Version

1.8.4

Vitest Version

2.1.8

Validations

Screenshots

Example of the extension failing
image

Example of CLI working just fine:
image

@TheDutchCoder
Copy link
Author

Additional info: the CLI version also doesn't work when ran from the root with vitest directly, only when fed the config file.
Is this an issue with vitest itself then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant