diff --git a/code/addons/test/src/postinstall.ts b/code/addons/test/src/postinstall.ts index cac46c5fa619..c7c6331bed00 100644 --- a/code/addons/test/src/postinstall.ts +++ b/code/addons/test/src/postinstall.ts @@ -407,6 +407,8 @@ export default async function postInstall(options: PostinstallOptions) { // If there's an existing config, we create a workspace file so we can run Storybook tests alongside. const extension = extname(rootConfig); const browserWorkspaceFile = resolve(dirname(rootConfig), `vitest.workspace${extension}`); + // to be set in vitest config + const vitestSetupFilePath = relative(dirname(browserWorkspaceFile), vitestSetupFile); logger.line(1); logger.plain(`${step} Creating a Vitest project workspace file:`); @@ -442,7 +444,7 @@ export default async function postInstall(options: PostinstallOptions) { name: 'chromium', provider: 'playwright', }, - setupFiles: ['./.storybook/vitest.setup.ts'], + setupFiles: ['${vitestSetupFilePath}'], }, }, ]);