-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
35 lines (35 loc) · 1.07 KB
/
jest.config.js
File metadata and controls
35 lines (35 loc) · 1.07 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
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
roots: ["<rootDir>/src"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/.next/"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": [
"@swc/jest",
{
jsc: {
transform: {
react: {
runtime: "automatic",
},
},
},
},
],
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
// Mock CSS imports
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
// Mock image imports
"\\.(jpg|jpeg|png|gif|webp|svg)$": "<rootDir>/__mocks__/fileMock.js",
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
// Set up a global mock for fetch
setupFiles: ["<rootDir>/jest.globalSetup.js"],
testEnvironmentOptions: {
// Add browser-like globals
url: "http://localhost/",
},
};