forked from Caleydo/tdp_publicdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
49 lines (47 loc) · 1.41 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
// 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: {
"^.+\\.(js|ts|tsx)$": "ts-jest",
"\\.xml$": "jest-raw-loader"
},
testRegex: "(.*(test|spec))\\.(tsx?)$",
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
modulePaths: [
"src"
],
transformIgnorePatterns: [`../node_modules/${pluginsToTransform}`, `node_modules/${pluginsToTransform}`],
globals: {
"__VERSION__": "TEST_VERSION",
"__APP_CONTEXT__": "TEST_CONTEXT",
// has to be set to true, otherwise i18n import fails
"ts-jest": {
"tsconfig": {
"esModuleInterop": true
}
}
},
moduleNameMapper: {
"^.+\\.(css|less|scss|sass|png|jpg|gif)$": "identity-obj-proxy"
}
}