-
Notifications
You must be signed in to change notification settings - Fork 24
/
jest.config.js
38 lines (34 loc) · 1.24 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
const path = require("path");
const webpackConfig = require("./webpack.config.common");
const rootFolder = __dirname;
// Read aliases from webpack configuration and convert to a format that jest understands
const mappedModuleAliases = Object.entries(webpackConfig.resolve.alias)
.map(([key, value]) => [`^${key}/(.*)$`, `${value}/$1`])
.reduce((acc, [key, value]) => {
acc[key] = value;
return acc;
}, {});
// This is needed, otherwise Jest gives an error when it tries importing css/scss files.
mappedModuleAliases["\\.(css|scss)$"] = "jest/__mocks__/styleMock.ts";
module.exports = {
verbose: true,
moduleNameMapper: mappedModuleAliases,
coverageDirectory: "<rootDir>/client-coverage",
coveragePathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/build/"],
coverageReporters: ["text-summary", "json", "html"],
coverageThreshold: {
global: {
branches: 35,
functions: 40,
lines: 55,
statements: 55,
},
},
globals: {},
moduleDirectories: ["node_modules", "src"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
modulePaths: ["<rootDir>/"],
rootDir: "./",
testMatch: ["<rootDir>/**/**/*.test.{js,jsx,ts,tsx}"],
testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/build/"],
};