diff --git a/code/addons/test/src/vitest-plugin/index.ts b/code/addons/test/src/vitest-plugin/index.ts index ebe4bb20b281..a3257e77b7ea 100644 --- a/code/addons/test/src/vitest-plugin/index.ts +++ b/code/addons/test/src/vitest-plugin/index.ts @@ -134,13 +134,15 @@ export const storybookTest = (options?: UserOptions): Plugin => { config.optimizeDeps ??= {}; config.optimizeDeps = { ...config.optimizeDeps, - include: [ - ...(config.optimizeDeps.include ?? []), - 'react-dom/test-utils', - '@storybook/experimental-addon-test/**', - ], + include: [...(config.optimizeDeps.include ?? []), '@storybook/experimental-addon-test/**'], }; + if (frameworkName?.includes('react') || frameworkName?.includes('nextjs')) { + config.optimizeDeps.include.push('react-dom/test-utils'); + } + + console.log(config.optimizeDeps); + if (frameworkName?.includes('vue3')) { config.define ??= {}; config.define.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = 'false';