-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.project.js
More file actions
26 lines (23 loc) · 814 Bytes
/
jest.project.js
File metadata and controls
26 lines (23 loc) · 814 Bytes
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
const path = require('path');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const ROOT_DIR = __dirname;
const TSCONFIG = path.resolve(ROOT_DIR, 'tsconfig.json');
const tsconfig = require(TSCONFIG);
module.exports = ({ dirname }) => {
const pkg = require(path.resolve(dirname, 'package.json'));
const isRoot = ROOT_DIR === dirname;
const nameKeys = !isRoot ? {} : {
name: pkg.name,
displayName: pkg.name
};
return {
...nameKeys,
rootDir: dirname,
cacheDirectory: path.resolve(ROOT_DIR, 'node_modules/.cache/jest'),
transform: { '^.+\\.tsx?$': 'ts-jest' },
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: `${ROOT_DIR}/` }),
modulePathIgnorePatterns: ['dist'],
collectCoverage: true,
restoreMocks: true,
};
};