-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathjest.config.js
More file actions
83 lines (83 loc) · 2.53 KB
/
jest.config.js
File metadata and controls
83 lines (83 loc) · 2.53 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const { pathsToModuleNameMapper } = require("ts-jest");
const tsconfig = require("../../tsconfig.base.json");
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
roots: ["<rootDir>/src"],
preset: "../../jest.preset.js",
setupFilesAfterEnv: ["./jest.setup.js"],
testEnvironment: "jsdom",
collectCoverageFrom: [
"src/**/*.{js,jsx,ts,tsx}",
// @todo they actually don't work, so we had to add `istanbul ignore` directive to some files
"!**/__mocks__/**",
"!**/*.d.ts",
"!**/node_modules/**",
"!**/examples/**",
// it breaks internal coverage counters because of dynamic imports
"!src/**/SplitChannel.ts",
],
coverageDirectory: "../../coverage",
coverageReporters: ["json", "lcov", "text"],
coverageThreshold: {
global: {
branches: 1,
functions: 1,
lines: 1,
statements: 1,
},
},
transform: {
"^.+\\.[tj]sx?$": [
"babel-jest",
{
babelrc: false,
configFile: false,
presets: [
[
"@babel/preset-react",
{
runtime: "automatic",
},
],
"@babel/preset-typescript",
[
"@babel/preset-env",
{
targets: {
browsers: ["last 2 Chrome versions"],
node: "current",
},
},
],
],
plugins: [
["babel-plugin-import", { libraryName: "antd", style: false }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
],
},
],
},
moduleFileExtensions: ["js", "ts", "jsx", "tsx"],
moduleDirectories: ["node_modules"],
moduleNameMapper: {
"^konva": "konva/konva",
"^keymaster": "identity-obj-proxy",
"^react-konva-utils": "identity-obj-proxy",
"\\.(css|svg|png|jpe?g)$": "identity-obj-proxy",
"^@adobe/css-tools$": "<rootDir>/../../__mocks__/@adobe/css-tools.js",
"^@humansignal/ui": "<rootDir>/../ui/src/index.ts",
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: "<rootDir>/../../",
}),
},
testPathIgnorePatterns: [
"/node_modules/",
"/e2e/",
// Full-app renderEditor tests require MST/load order not available in this env; skip until integration setup is ready.
"renderEditor\\.test\\.",
],
transformIgnorePatterns: ["node_modules/?!(nanoid|konva|@adobe)"],
};