forked from morfeojs/morfeo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
52 lines (47 loc) · 1.28 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
const fs = require('fs');
const baseConfig = require('./jest.base');
function getAllInternalPackages() {
return fs
.readdirSync('./packages', { withFileTypes: true })
.filter(directory => directory.isDirectory())
.map(directory => directory.name);
}
const packages = getAllInternalPackages();
const projects = packages.map(package => {
let packageConfig = {};
const packageJson = JSON.parse(
fs.readFileSync(`./packages/${package}/package.json`),
);
if (fs.existsSync(`./packages/${package}/jest.config.js`)) {
packageConfig = require(`./packages/${package}/jest.config.js`);
}
return {
rootDir: `packages/${package}`,
displayName: packageJson.name,
...baseConfig,
...packageConfig,
};
});
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
projects,
coverageDirectory: './coverage',
coverageReporters: ['json-summary', 'text', 'html', 'lcov'],
collectCoverageFrom: [
'<rootDir>/src/**/**',
'!<rootDir>/src/**/**/index.ts',
'!<rootDir>/src/**/**/*.d.ts',
'!<rootDir>/src/**/mocks/**/**',
],
moduleNameMapper: {
'@morfeo/(.*)': '<rootDir>/packages/$1/src',
},
coverageThreshold: {
global: {
lines: 90,
branches: 90,
functions: 90,
statements: 90,
},
},
};