chore(web): configure vitest with jsdom env, JSX, and setup file
This commit is contained in:
parent
2b8a0e2503
commit
a04e97a753
@ -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
7
apps/web/vitest.setup.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { afterEach } from "vitest";
|
||||
import { cleanup } from "@testing-library/react";
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user