From b33bf8a49edaff02582c2d78de7cc3e6aee7e97e Mon Sep 17 00:00:00 2001 From: Marco Pasqualetti Date: Tue, 16 Jul 2024 18:15:49 +0200 Subject: [PATCH] test(types): fix broken tests --- vitest.workspace.typescript.mts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vitest.workspace.typescript.mts b/vitest.workspace.typescript.mts index 731fe4dd..e238f022 100644 --- a/vitest.workspace.typescript.mts +++ b/vitest.workspace.typescript.mts @@ -27,6 +27,17 @@ export default defineWorkspace( test: { dir: `./${dirPath}`, name: workspaceName, + alias: { + /** + * From `vitest` >= 2 imports are resolved even if we are running only typecheck tests. + * This will result in: + * ```text + * Error: Failed to resolve entry for package "react-i18next". The package may have incorrect main/module/exports specified in its package.json. + * ``` + * To avoid a useless build process before running these tests an empty alias to `react-i18next` is added. + */ + 'react-i18next': '', + }, typecheck: { enabled: true, include: [`**/${dirPath}/*.test.{ts,tsx}`],