Skip to content

Extension doesn't resolve Nuxt 3 aliases #564

Open
@TheDutchCoder

Description

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

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions