This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
forked from edrlab/thorium-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
55 lines (51 loc) · 1.79 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
const { pathsToModuleNameMapper } = require('ts-jest/utils');
// const { defaults: tsjPreset } = require('ts-jest/presets');
// const { jsWithTs: tsjPreset } = require('ts-jest/presets');
// const { jsWithBabel: tsjPreset } = require('ts-jest/presets');
// console.log(tsjPreset.transform);
const { compilerOptions } = require("./tsconfig");
// const fs = require("fs");
// const compilerOptions = JSON.parse(fs.readFileSync("./tsconfig.json", { encoding: "utf8" })).compilerOptions;
const pathMaps = pathsToModuleNameMapper(compilerOptions.paths, { prefix: "<rootDir>/" } );
// console.log(pathMaps);
const moduleNameMapper = {
"readium-desktop/main/di": "<rootDir>/test/main/di.ts", // se src/common/utils.ts convertMultiLangStringToString()
...pathMaps,
// ...{
// "^@r2\\-streamer\\-js/(.*)$": "<rootDir>/scripts/jest_void.ts",
// "^@r2\\-navigator\\-js/(.*)$": "<rootDir>/scripts/jest_void.ts",
// },
};
// console.log(moduleNameMapper);
module.exports = {
verbose: true,
testEnvironment: "node",
preset: "ts-jest",
globals: {
"ts-jest": {
babelConfig: false,
tsConfig: "<rootDir>/tsconfig.json",
}
},
transform: {
"\\.ts$": "<rootDir>/scripts/jest_preprocessor.js",
// ...tsjPreset.transform,
// "^.+\\.tsx?$": ["ts-jest", {}],
},
transformIgnorePatterns: ["<rootDir>/node_modules/"],
moduleNameMapper,
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
],
testPathIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/dist/",
"<rootDir>/src/",
],
setupFilesAfterEnv: ['<rootDir>/scripts/jest_setup.js'],
// runner: '@jest-runner/electron/main', // package.json dev dep: @jest-runner/electron
};