chore(web): configure vitest with jsdom env, JSX, and setup file

This commit is contained in:
kumarabhirup 2026-03-02 18:32:38 -08:00
parent 2b8a0e2503
commit a04e97a753
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167
2 changed files with 23 additions and 1 deletions

View File

@ -2,13 +2,28 @@ import { defineConfig } from "vitest/config";
import path from "node:path";
export default defineConfig({
esbuild: {
jsx: "automatic",
jsxImportSource: "react",
},
resolve: {
alias: {
"@": path.resolve(__dirname),
},
},
test: {
include: ["lib/**/*.test.ts", "app/**/*.test.ts"],
environment: "node",
environmentMatchGlobs: [
["app/components/**/*.test.tsx", "jsdom"],
["app/workspace/**/*.test.tsx", "jsdom"],
],
setupFiles: ["./vitest.setup.ts"],
include: [
"lib/**/*.test.ts",
"lib/**/*.test.tsx",
"app/**/*.test.ts",
"app/**/*.test.tsx",
],
testTimeout: 30_000,
},
});

7
apps/web/vitest.setup.ts Normal file
View File

@ -0,0 +1,7 @@
import "@testing-library/jest-dom/vitest";
import { afterEach } from "vitest";
import { cleanup } from "@testing-library/react";
afterEach(() => {
cleanup();
});