mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
21302d4dd8
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Vladimir Sheremet <[email protected]>
1013 B
1013 B
title, outline
| title | outline |
|---|---|
| alias | Config | 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. :::