Skip to content

Conversation

@mag123c
Copy link
Contributor

@mag123c mag123c commented Feb 18, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Docs
  • Other... Please describe:

What is the current behavior?

Vitest does not automatically resolve TypeScript path aliases (src/), unlike Jest, which uses moduleNameMapper.
This can lead to dependency resolution errors when running tests

Issue Number: nestjs/nest#14653

What is the new behavior?

  • Updated the SWC documentation to include a fix for Vitest path alias resolution.
  • Added resolve.alias configuration in vitest.config.ts to ensure correct module resolution.
  • Explained why Vitest requires explicit path alias configuration, improving clarity for users.
  • Ensured consistency with Jest’s moduleNameMapper behavior.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This PR improves the official documentation by adding an alias resolution configuration to prevent common Vitest issues when running tests in NestJS projects. This ensures a smoother developer experience and avoids dependency resolution errors.

@kamilmysliwiec kamilmysliwiec merged commit b0b8d77 into nestjs:master Feb 19, 2025
@kamilmysliwiec
Copy link
Member

LGTM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants