-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.mjs
More file actions
38 lines (37 loc) · 1.32 KB
/
jest.config.mjs
File metadata and controls
38 lines (37 loc) · 1.32 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
34
35
36
37
38
// jest.config.mjs
import { createDefaultPreset } from "ts-jest";
const { transform } = createDefaultPreset();
export default {
// Keep a fast node project for non-DOM tests, and a jsdom "browser" project for react tests.
projects: [
{
displayName: "node",
testEnvironment: "node",
transform,
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
testMatch: [
"<rootDir>/test/**/*.node.test.(ts|tsx|js)",
"<rootDir>/test/**/*.test.(ts|js)", // generic node tests (adjust if needed)
],
},
{
displayName: "browser",
testEnvironment: "jsdom",
transform,
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
// Explicitly run the useConversation test (and any other browser tests you add)
testMatch: [
"<rootDir>/test/useConversation.test.tsx",
"<rootDir>/test/useSession.test.tsx",
"<rootDir>/test/**/*.browser.test.(ts|tsx|js)",
],
setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts"],
moduleNameMapper: {
// Force resolution of react/react-dom to the single copy in root node_modules
"^react$": "<rootDir>/node_modules/react",
"^react-dom$": "<rootDir>/node_modules/react-dom",
"^react/jsx-runtime$": "<rootDir>/node_modules/react/jsx-runtime",
},
},
],
};