nuxt / nuxt/test-utils

alias in test files while using workspace not working

Open
#723 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
Dominant language
TypeScript
Stars
437
Forks
120
Avg merge
22h 52m
Merged PRs (30d)
23

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction and inspect the root alias.ts and vitest.workspace.ts files, then run the workspace tests from the repository root using the reported Nuxt and Vitest setup. Done means aliases declared at the root resolve in test files as they already do in the application.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, nuxtjs, typescript
Domain
testing, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.