Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
Markdown
title: alias | Config outline: deep #
alias #
- Type:
Record<string, string> | Array<{ find: string | RegExp, replacement: string, customResolver?: ResolverFunction | ResolverObject }>
Define custom aliases when running inside tests. They will be merged with aliases from resolve.alias.
::: warning Vitest uses Vite SSR primitives to run tests which has certain pitfalls.
- Aliases affect only modules imported directly with an
importkeyword by an inlined module (all source code is inlined by default). - Vitest does not support aliasing
requirecalls. - If you are aliasing an external dependency (e.g.,
react->preact), you may want to alias the actualnode_modulespackages instead to make it work for externalized dependencies. Both Yarn and pnpm support aliasing via thenpm:prefix.
:::