-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
35 lines (27 loc) · 956 Bytes
/
jest.config.js
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
require("dotenv/config"); // Load environment variables from .env
const { pathsToModuleNameMapper } = require("ts-jest/utils");
const { compilerOptions } = require("./tsconfig.json");
// Disable the browser-run mock, we'll add test env mocks when needed
process.env.FRONTEND_MOCK_API_SERVER = "false";
module.exports = {
preset: "ts-jest",
globals: {
"ts-jest": {
isolatedModules: true,
},
},
moduleNameMapper: {
// Use import paths as defined in tsconfig.json
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: "<rootDir>/" }),
// Mock imports for non-script files
"\\.css$": "<rootDir>/tests/mocks/style.mock.ts",
},
// Clear mock calls/counters/instances before each test
clearMocks: true,
// Only look for test files in these directories
roots: ["<rootDir>/src/", "<rootDir>/tests/"],
setupFilesAfterEnv: [
"@testing-library/jest-dom",
"<rootDir>/tests/jest.setup.ts",
],
};