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

alias in test files while using workspace not working #723

Open
ThiloHettmer opened this issue Jan 18, 2024 · 1 comment
Open

alias in test files while using workspace not working #723

ThiloHettmer opened this issue Jan 18, 2024 · 1 comment

Comments

@ThiloHettmer
Copy link

Environment

os: Ubuntu 22.04
node: 21.0.0
nuxt: 3.9.3
@nuxt/test-utils: 2.4.3
vitest: 1.0.4
pnpm: 8.3.1

Reproduction

https://github.com/ThiloHettmer/test-utils-alias-issue/tree/main

Describe the bug

Hi all,

we use a monorepo with multiple layers and apps. The aliases are declared in root via an alias.ts file. They work in our application but not in test files. I've tried alot of things to resolve these aliases but could not get it to work. Note: we want to start the vitest from the root folder and got a vitest.workspace.ts file.

Perhaps I'm just missing something.

Thanks, and gd

Additional context

No response

Logs

No response

@joris-fonck-loreal
Copy link

Hello,

You can resolve it by using extends property instead of plain string.

export default defineWorkspace([
  {
    extends: './path/to/app/vitest.config.js'
  }
])

but unfortunately, a new error occurs: ref is not defined (If you are using vue ref for example). This is related to nuxt auto-imports feature. I don't know how to solve it at the moment.

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

2 participants