-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
26 lines (26 loc) · 1.12 KB
/
jest.config.js
File metadata and controls
26 lines (26 loc) · 1.12 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
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
preset: "ts-jest/presets/default-esm",
extensionsToTreatAsEsm: [".ts"],
testEnvironment: "node",
moduleNameMapper: {
// Handle .js imports from TypeScript files
"^(\\.{1,2}/.*)\\.js$": "$1",
},
// Setup files to run before tests
setupFilesAfterEnv: ["<rootDir>/tests/setup/jest.setup.ts"],
// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8", // or "babel"
// A list of paths to directories that Jest should use to search for files in
roots: ["<rootDir>/tests"],
// The testMatch patterns Jest uses to detect test files
testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"],
// A map from regular expressions to paths to transformers
transform: {
"^.+\\.(ts|tsx)$": ["ts-jest", { useESM: true }],
},
};