-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.cjs
66 lines (52 loc) · 2.47 KB
/
jest.config.cjs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
coverageReporters: ["text", "cobertura"],
// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: ["node_modules", "<rootDir>/src"],
// An array of file extensions your modules use
moduleFileExtensions: ["ts", "tsx", "js"],
// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/__mocks__/fileMock.js",
"@/(.*)": "<rootDir>/src/$1",
"@S/(.*)": "<rootDir>/src/Slices/$1",
"^lodash-es$": "<rootDir>/node_modules/lodash/index.js", // Use CommonJS version of lodash in the test cases instead of ESM
// mapper for the aliassing '@joint/core': '@intmant/rappid'
"^@joint/core$": "<rootDir>/node_modules/@inmanta/rappid",
// Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
uuid: require.resolve("uuid"),
},
// A preset that is used as a base for Jest's configuration
preset: "ts-jest/presets/js-with-ts",
setupFiles: ["<rootDir>/jest.polyfills.js", "<rootDir>/jestSetup.ts"],
// The path to a module that runs some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ["<rootDir>/jestSetupAfterEnv.js"],
// The test environment that will be used for testing.
testEnvironment: "jsdom",
// The glob patterns Jest uses to detect test files
testMatch: ["**/*.(spec|test).(ts|tsx)"],
// A map from regular expressions to paths to transformers
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
testEnvironmentOptions: {
customExportConditions: [""],
},
reporters: ["default", "jest-junit"],
// The react-syntax-highlighter, mermaid and @inmanta/rappid esm modules have to be handled by jest
transformIgnorePatterns: [
"node_modules/(?!react-syntax-highlighter|@inmanta/rappid|mermaid/dist/mermaid.js)",
],
globals: {
"ts-jest": {
isolatedModules: true,
},
},
};