This repository has been archived by the owner on Mar 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from datavisyn/stoiber/testing_with_jest
Use Jest for testing
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters