-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathjest.config.js
63 lines (63 loc) · 2.02 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
57
58
59
60
61
62
63
/** @type {import('jest').Config} */
module.exports = {
testEnvironment: "jsdom",
transformIgnorePatterns: [
"node_modules/(?!(lit|@lit|lit-html|@lit-labs))"
],
transform: {
"^.+\\.(t|j)sx?$": ["ts-jest", {
useESM: true,
tsconfig: "tsconfig.jest.json",
diagnostics: {
warnOnly: true, // Convert type-check errors to warnings during tests
ignoreCodes: [
"TS7006", // Parameter implicitly has an 'any' type
"TS7015", // Element implicitly has an 'any' type because index expression is not of type 'number'
"TS7031", // Binding element implicitly has an 'any' type
"TS7053", // Element implicitly has an 'any' type because expression of type can't be used to index type
"TS2683", // 'this' implicitly has type 'any' because it does not have a type annotation
"TS2345", // Argument of type is not assignable to parameter of type
"TS2322", // Type is not assignable to type
"TS18047", // Object is possibly 'null'
"TS18048" // Property is possibly 'undefined'
]
}
}]
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
preset: "ts-jest/presets/default-esm",
extensionsToTreatAsEsm: [".ts", ".tsx"],
testEnvironmentOptions: {
url: "http://localhost"
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
moduleNameMapper: {
"^lit$": "<rootDir>/node_modules/lit/development/index.js",
"^lit/directive$": "<rootDir>/node_modules/lit/development/directive.js",
"^lit/directives/(.*)$": "<rootDir>/node_modules/lit/development/directives/$1",
"^(\\.{1,2}/.*)\\.js$": "$1",
"^(\\.{1,2}/.*)\\.jsx?$": "$1",
"^(\\.{1,2}/.*)\\.tsx?$": "$1"
},
globals: {
'ts-jest': {
tsconfig: 'tsconfig.jest.json',
useESM: true,
isolatedModules: true
}
},
testPathIgnorePatterns: [
"/node_modules/",
"/dist/",
"/coverage/",
"/esm/"
]
};