This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
55 lines (53 loc) · 1.59 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
// test dependencies that require transformation
let pluginsToTransform = [
'tdp_*',
'phovea_*',
'lineupjs'
].join('|');
if(pluginsToTransform.length > 0) {
/** Attention: Negative Lookahead! This regex adds the specified repos to a whitelist that holds plugins that are excluded from the transformIgnorePatterns.
* This means that pluginsToTransform should contain all repos that export ts files. They can only be handled by the transformation. */
pluginsToTransform = `(?!${pluginsToTransform})`;
}
/**
* TODO check if we can process inline webpack loaders (e.g. as found in https://github.com/phovea/phovea_ui/blob/master/src/_bootstrap.ts)
* see also https://jestjs.io/docs/en/webpack#mocking-css-modules
*/
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
"\\.xml$": "jest-raw-loader"
},
testRegex: "(.*(test|spec))\\.(tsx?)$",
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
modulePaths: [
"src",
"../node_modules",
"../"
],
transformIgnorePatterns: [`../node_modules/${pluginsToTransform}`, `node_modules/${pluginsToTransform}`],
globals: {
"__VERSION__": "TEST_VERSION",
"__APP_CONTEXT__": "TEST_CONTEXT",
'ts-jest': {
// has to be set to true, otherwise i18n import fails
"tsconfig": {
"esModuleInterop": true,
}
}
},
moduleNameMapper: {
"^.+\\.(css|less|scss|sass|png|jpg|gif)$": "identity-obj-proxy",
"imports-loader?.*": "imports-loader",
"raw-loader?.*": "raw-loader",
"file-loader?.*": "file-loader",
"script-loader?.*": "script-loader"
}
}