2024-02-15 22:34:59 -05:00
|
|
|
import { defineConfig, mergeConfig } from "vitest/config";
|
2026-05-11 16:39:53 +02:00
|
|
|
import { playwright } from "@vitest/browser-playwright";
|
|
|
|
|
import { vitePluginsConfig } from "./vite.config";
|
|
|
|
|
import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
|
|
|
|
|
import path from "node:path";
|
|
|
|
|
import { fileURLToPath } from "node:url";
|
2025-08-04 18:50:57 +02:00
|
|
|
|
2026-05-11 16:39:53 +02:00
|
|
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
2024-02-02 18:54:50 -06:00
|
|
|
|
2024-02-15 22:34:59 -05:00
|
|
|
export default defineConfig((configEnv) =>
|
|
|
|
|
mergeConfig(
|
2026-05-11 16:39:53 +02:00
|
|
|
vitePluginsConfig(configEnv),
|
2024-02-15 22:34:59 -05:00
|
|
|
defineConfig({
|
|
|
|
|
test: {
|
2026-05-20 16:28:04 +02:00
|
|
|
fileParallelism: true,
|
2026-05-11 16:39:53 +02:00
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
extends: true,
|
|
|
|
|
test: {
|
2026-05-11 19:16:07 +02:00
|
|
|
name: "unit",
|
2026-05-11 16:39:53 +02:00
|
|
|
css: {
|
2026-05-15 18:37:25 +02:00
|
|
|
include: /.+/,
|
2026-05-11 16:39:53 +02:00
|
|
|
modules: {
|
|
|
|
|
classNameStrategy: "non-scoped",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
setupFiles: ["src/vitest.setup.ts"],
|
|
|
|
|
environment: "jsdom",
|
|
|
|
|
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
|
|
|
|
|
},
|
2024-02-15 22:34:59 -05:00
|
|
|
},
|
2026-05-11 16:39:53 +02:00
|
|
|
{
|
|
|
|
|
plugins: [
|
|
|
|
|
storybookTest({
|
|
|
|
|
// The location of your Storybook config, main.js|ts
|
2026-05-20 13:26:52 +02:00
|
|
|
configDir: "./.storybook",
|
2026-05-11 16:39:53 +02:00
|
|
|
}),
|
|
|
|
|
...vitePluginsConfig(configEnv).plugins!,
|
|
|
|
|
],
|
|
|
|
|
test: {
|
|
|
|
|
name: "storybook",
|
|
|
|
|
browser: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
// Make sure to install Playwright
|
|
|
|
|
provider: playwright(),
|
|
|
|
|
headless: true,
|
2026-05-11 19:29:07 +02:00
|
|
|
instances: [{ browser: "chromium" }],
|
2026-05-11 16:39:53 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2024-02-15 22:34:59 -05:00
|
|
|
coverage: {
|
2024-08-27 09:45:39 -04:00
|
|
|
reporter: ["html", "json"],
|
2026-04-17 11:13:41 +02:00
|
|
|
include: ["src/**/*.{ts,tsx,js,jsx}"],
|
2024-12-19 15:54:28 +00:00
|
|
|
exclude: [
|
2026-04-17 11:13:41 +02:00
|
|
|
"src/**/*.md",
|
2026-04-08 16:38:52 +02:00
|
|
|
"src/**/*.{d,test,stories}.{ts,tsx}",
|
2024-12-19 15:54:28 +00:00
|
|
|
"src/utils/test.ts",
|
|
|
|
|
"src/utils/test-viewmodel.ts",
|
|
|
|
|
"src/utils/test-fixtures.ts",
|
2025-03-13 15:20:40 +01:00
|
|
|
"playwright/**",
|
2024-12-19 15:54:28 +00:00
|
|
|
],
|
2024-02-15 22:34:59 -05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|