Chore/fix tests * chore: Upgrade nextjs@16.1.1 * chore: upgrade next@16.1.1 * upgrade underlying types * merge * Fix broken tests * bump @swc/plugin-formatjs to latest version * bump sentry * transpile "import-in-the-middle" & "require-in-the-middle" * revert next@16.1.1 upgrade * revert transpilation addition * .
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import { defineConfig, mergeConfig } from "vitest/config"
|
|
import { storybookTest } from "@storybook/addon-vitest/vitest-plugin"
|
|
import { playwright } from "@vitest/browser-playwright"
|
|
import path from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
|
|
const dirname =
|
|
typeof __dirname !== "undefined"
|
|
? __dirname
|
|
: path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
import viteConfig from "./vite.config"
|
|
|
|
const isCI = process.env.CI === "true"
|
|
|
|
const browserInstances = isCI
|
|
? [{ browser: "chromium" as const }]
|
|
: [
|
|
{ browser: "chromium" as const },
|
|
{ browser: "firefox" as const },
|
|
{ browser: "webkit" as const },
|
|
]
|
|
|
|
export default mergeConfig(
|
|
viteConfig,
|
|
defineConfig({
|
|
test: {
|
|
projects: [
|
|
{
|
|
test: {
|
|
name: "unit",
|
|
environment: "jsdom",
|
|
},
|
|
},
|
|
{
|
|
plugins: [
|
|
storybookTest({
|
|
// The location of your Storybook config, main.js|ts
|
|
configDir: path.join(dirname, ".storybook"),
|
|
// This should match your package.json script to run Storybook
|
|
// The --ci flag will skip prompts and not open a browser
|
|
storybookScript: "yarn storybook --ci",
|
|
}),
|
|
],
|
|
test: {
|
|
name: "storybook",
|
|
// Enable browser mode
|
|
browser: {
|
|
enabled: true,
|
|
// Make sure to install Playwright
|
|
provider: playwright(),
|
|
headless: true,
|
|
instances: browserInstances,
|
|
},
|
|
fileParallelism: false,
|
|
setupFiles: ["./.storybook/vitest.setup.ts"],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})
|
|
)
|