summaryrefslogtreecommitdiffhomepage
path: root/vite.config.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-06 22:24:20 +0900
committerAdam Malczewski <[email protected]>2026-06-06 22:24:20 +0900
commitf1409cd46d5a3cfb9002cbcdfd4ab947ac6846aa (patch)
treea035b2e2d2cb122cdd54c841d87e45965746e2c5 /vite.config.ts
parente1c8cf3257cb33457aa882c548f5195ecc0f9854 (diff)
downloaddispatch-web-f1409cd46d5a3cfb9002cbcdfd4ab947ac6846aa.tar.gz
dispatch-web-f1409cd46d5a3cfb9002cbcdfd4ab947ac6846aa.zip
Slice 1 follow-up: component-render interaction tests (CR-1/CR-2)
- vite: add @testing-library/svelte's svelteTesting() plugin so component render()/mount() resolves Svelte's browser build under vitest/jsdom - dep: @testing-library/user-event for realistic interaction tests - app: 7 component-render tests driving App.svelte through a fake socket (catalog render, subscribe-on-click, unsub/sub ordering, aria-current, error banner, action invoke) Verified green: svelte-check 0/0, vitest 91 passed, biome clean, vite build ok.
Diffstat (limited to 'vite.config.ts')
-rw-r--r--vite.config.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/vite.config.ts b/vite.config.ts
index fab62a0..5ff83cd 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,10 +1,14 @@
import { svelte } from "@sveltejs/vite-plugin-svelte";
+import { svelteTesting } from "@testing-library/svelte/vite";
import { defineConfig } from "vitest/config";
// Dev server on the reserved FRONTEND_PORT (24204). Vitest config lives here too
// (jsdom + globals) so component tests run without extra config.
export default defineConfig({
- plugins: [svelte()],
+ // svelteTesting() forces Svelte's `browser` resolve condition under vitest so
+ // component render()/mount() works in jsdom (a plain test.resolve.conditions
+ // does not propagate to Vite's SSR resolution — sveltejs/svelte#11394).
+ plugins: [svelte(), svelteTesting()],
// Bind all interfaces + accept any Host header so the dev server is reachable over a LAN /
// Tailscale. Safe for LOCAL-NETWORK-ONLY use (NOT internet-exposed): `allowedHosts: true`
// disables Vite's DNS-rebinding host check. (The WS URL still runs in the browser — set
@@ -14,10 +18,5 @@ export default defineConfig({
environment: "jsdom",
globals: true,
setupFiles: ["./vitest-setup.ts"],
- // Svelte 5's exports map resolves `svelte` → server build under the default
- // condition; force the browser build so component tests can mount().
- resolve: {
- conditions: ["browser"],
- },
},
});