-
Notifications
You must be signed in to change notification settings - Fork 8
/
jest.config.js
53 lines (48 loc) · 1.36 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const path = require("path");
const fs = require("fs");
const { pathsToModuleNameMapper } = require("ts-jest");
const testsTsConfigPath = path.resolve(__dirname, "tests", "tsconfig.json");
const tsconfig = JSON.parse(
fs.readFileSync(testsTsConfigPath, {
encoding: "utf-8",
})
);
const moduleNameMapper = {
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: "<rootDir>",
}),
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
};
const collectCoverageFrom = ["<rootDir>/src/**/!(*.d).ts*"];
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
const defaultConfig = {
coverageDirectory: "coverage",
globals: {
"ts-jest": {
diagnostics: false,
isolatedModules: true,
tsconfig: testsTsConfigPath,
},
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
moduleNameMapper,
preset: "ts-jest/presets/js-with-ts",
setupFiles: [
"jest-date-mock",
"<rootDir>/tests/mocks/electron.ts",
"<rootDir>/tests/mocks/new-user-config.ts",
"<rootDir>/tests/mocks/i18next.ts",
"<rootDir>/tests/setup/env.ts",
],
};
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
collectCoverageFrom,
projects: [
{
displayName: "integration",
testMatch: ["<rootDir>/tests/integration/**/?(*.)(spec|test).(ts|tsx)"],
...defaultConfig,
},
],
};