From f3139a98de81c9e661fd92917ca2ab0d1c417c03 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 10 Jan 2025 14:21:58 +0100 Subject: [PATCH] use dynamic path for vitest.setup.js --- code/addons/test/src/postinstall.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/addons/test/src/postinstall.ts b/code/addons/test/src/postinstall.ts index 0ac20b91f9d..6ea68c382d4 100644 --- a/code/addons/test/src/postinstall.ts +++ b/code/addons/test/src/postinstall.ts @@ -409,6 +409,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:`); @@ -444,7 +446,7 @@ export default async function postInstall(options: PostinstallOptions) { name: 'chromium', provider: 'playwright', }, - setupFiles: ['./.storybook/vitest.setup.ts'], + setupFiles: ['${vitestSetupFilePath}'], }, }, ]);