Skip to content

Commit

Permalink
Addon Test: Only optimize react deps if applicable in vitest-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Nov 14, 2024
1 parent 28b94f8 commit b7b7b1c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions code/addons/test/src/vitest-plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit b7b7b1c

Please sign in to comment.