From abf084e562d803214a398e59f9c8b0fb76607504 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Thu, 25 Jul 2024 15:22:01 +0100 Subject: [PATCH] fix(vite): vitest executor should continue to load plugins #22001 --- packages/vite/src/executors/test/lib/utils.ts | 5 ++++- packages/vite/src/executors/test/vitest.impl.ts | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/executors/test/lib/utils.ts b/packages/vite/src/executors/test/lib/utils.ts index 037bac51acfab..7c1239b40c22a 100644 --- a/packages/vite/src/executors/test/lib/utils.ts +++ b/packages/vite/src/executors/test/lib/utils.ts @@ -78,7 +78,10 @@ export async function getOptions( configFile: viteConfigPath, }; - return mergeConfig(resolved?.config?.['test'] ?? {}, settings); + return { + resolvedOptions: mergeConfig(resolved?.config?.['test'] ?? {}, settings), + plugins: resolved?.config?.plugins, + }; } export function getOptionsAsArgv(obj: Record): string[] { diff --git a/packages/vite/src/executors/test/vitest.impl.ts b/packages/vite/src/executors/test/vitest.impl.ts index 4af8a33c0a1e0..18e618254549f 100644 --- a/packages/vite/src/executors/test/vitest.impl.ts +++ b/packages/vite/src/executors/test/vitest.impl.ts @@ -19,7 +19,7 @@ export async function* vitestExecutor( // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future. const { startVitest } = await loadVitestDynamicImport(); - const resolvedOptions = + const { resolvedOptions, plugins } = (await getOptions(options, context, projectRoot)) ?? {}; const watch = resolvedOptions['watch'] === true; @@ -37,7 +37,8 @@ export async function* vitestExecutor( const ctx = await startVitest( resolvedOptions['mode'] ?? 'test', cliFilters, - resolvedOptions + resolvedOptions, + { plugins } ); let hasErrors = false;