-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathvitest.config.ts
More file actions
33 lines (32 loc) · 1.65 KB
/
Copy pathvitest.config.ts
File metadata and controls
33 lines (32 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/// <reference types="vitest/config" />
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
// Standalone test config so Vitest's options/types never leak into the Tauri +
// Vite production build (vite.config.ts). Vitest uses this file in preference to
// vite.config.ts when present. QUALITY-01.
export default defineConfig({
plugins: [react()],
resolve: {
// Some @codemirror/lang-* packages carry their own nested copy of
// @codemirror/state|view; without dedupe, vitest resolves two instances
// and EditorState.create rejects extensions built by the other copy
// ("Unrecognized extension value"). Vite's dep pre-bundling hides this
// in dev/build, so it only bites in tests.
// @codemirror/merge is here because reviewFind.integration.test.ts builds
// a real unifiedMergeView state; a second @codemirror/state copy behind it
// would fail EditorState.create with "Unrecognized extension value".
dedupe: ["@codemirror/state", "@codemirror/view", "@codemirror/language", "@codemirror/autocomplete", "@codemirror/lint", "@codemirror/merge"],
},
test: {
environment: "jsdom",
// Vitest normally hands node_modules to Node's resolver, which happily
// loads the nested copies and ignores `resolve.dedupe` above — inline
// the CodeMirror family so the deduped Vite resolution is used.
server: { deps: { inline: [/@codemirror[\\/]/] } },
setupFiles: ["./src/test/setup.ts"],
include: ["src/**/*.{test,spec}.{ts,tsx}"],
css: false,
clearMocks: true,
restoreMocks: true,
},
});