mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import react from "@vitejs/plugin-react";
|
|
import { resolve } from "path";
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
// Vitest configuration. Kept separate from `vite.config.mts` so the dev/build
|
|
// pipelines stay lean and so tests can opt into jsdom + @testing-library
|
|
// without dragging them into production bundles.
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
// Keep in sync with the `@/` alias declared in `vite.config.mts` so that
|
|
// test-time module resolution matches production/build.
|
|
alias: {
|
|
"@/": `${resolve(__dirname, "src")}/`,
|
|
},
|
|
},
|
|
test: {
|
|
environment: "jsdom",
|
|
setupFiles: ["./tests/setup.ts"],
|
|
include: ["tests/**/*.test.{ts,tsx}"],
|
|
// Keep each test hermetic:
|
|
// - mockReset clears call history and resets implementations for vi.fn()s,
|
|
// so module-level mocks (e.g. useCurrentUser) don't leak between tests.
|
|
// - restoreMocks additionally restores original implementations for spies.
|
|
mockReset: true,
|
|
restoreMocks: true,
|
|
},
|
|
});
|