-
Notifications
You must be signed in to change notification settings - Fork 715
Expand file tree
/
Copy pathjest.config.cjs
More file actions
24 lines (23 loc) · 881 Bytes
/
jest.config.cjs
File metadata and controls
24 lines (23 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const path = require("path");
module.exports = {
testEnvironment: "jsdom", // Use jsdom environment for DOM-related tests
roots: ["./src", "./example"], // The root directory for running tests
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
"^.+\\.(js|jsx)$": "babel-jest",
},
testMatch: [
"**/__tests__/**/*.(js|jsx|ts|tsx)",
"**/?(*.)+(spec|test).(js|jsx|ts|tsx)",
], // File patterns for test files
setupFilesAfterEnv: [
"@testing-library/jest-dom",
"<rootDir>/src/setupTests.js",
], // Setup file to extend Jest with RTL matchers
moduleNameMapper: {
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
"^src/(.*)$": path.resolve(__dirname, "src/$1"), // Add the moduleNameMapper for your alias
},
transformIgnorePatterns: ["/node_modules/(?!(lodash-es)/)"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
};