-
Notifications
You must be signed in to change notification settings - Fork 2
/
jest.config.js
56 lines (51 loc) · 1.49 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
54
55
56
const path = require("path");
const fs = require("fs");
const { pathsToModuleNameMapper } = require("ts-jest");
const tsconfig = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "tests", "tsconfig.json"), {
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 = {
// collectCoverageFrom,
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tests/tsconfig.json",
},
},
moduleFileExtensions: ["ts", "tsx", "js", "json"],
moduleNameMapper,
preset: "ts-jest",
};
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
collectCoverageFrom,
projects: [
{
displayName: "integration",
setupFilesAfterEnv: [
"<rootDir>/tests/integration/mock/electron.ts",
],
testMatch: [
"<rootDir>/tests/integration/**/?(*.)(spec|test).(ts|tsx)",
],
...defaultConfig,
},
{
displayName: "components",
testEnvironment: "jsdom",
testMatch: [
"<rootDir>/tests/components/**/?(*.)(spec|test).(ts|tsx)",
],
...defaultConfig,
},
],
};