-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
47 lines (44 loc) · 1.25 KB
/
jest.config.js
File metadata and controls
47 lines (44 loc) · 1.25 KB
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
const path = require('path');
const jsdomProjects = new Set(['react', 'playground']);
const makeProject = (name) => ({
displayName: name,
preset: 'ts-jest/presets/default-esm',
testEnvironment: jsdomProjects.has(name) ? 'jsdom' : 'node',
rootDir: path.join(
__dirname,
jsdomProjects.has(name) ? 'apps' : 'packages',
name === 'playground' ? 'playground' : name
),
testMatch: ['<rootDir>/src/**/__tests__/**/*.spec.ts?(x)'],
globals: {
'ts-jest': {
useESM: true,
tsconfig: path.join(
__dirname,
name === 'playground' ? 'apps/playground' : `packages/${name}`,
'tsconfig.json'
)
}
},
moduleNameMapper: {
'^@x-filter/(.*)$': '<rootDir>/../../packages/$1/src'
},
setupFilesAfterEnv: jsdomProjects.has(name)
? [path.join(__dirname, 'jest.setup.ts')]
: [],
coveragePathIgnorePatterns: ['/node_modules/'],
coverageDirectory: path.join(__dirname, 'coverage', name),
coverageReporters: ['text', 'html'],
coverageThreshold: {
global: {
statements: 95,
branches: 95,
functions: 95,
lines: 95
}
}
});
module.exports = {
collectCoverage: true,
projects: [makeProject('core'), makeProject('utils'), makeProject('react'), makeProject('playground')]
};