-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.preset.js
More file actions
48 lines (45 loc) · 1.28 KB
/
jest.preset.js
File metadata and controls
48 lines (45 loc) · 1.28 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
48
const nxPreset = require('@nx/jest/preset');
const isCI = process.env.CI === 'true' || process.env.BUILDKITE === 'true';
const config = {
...nxPreset,
resolver: '@nx/jest/plugins/resolver',
moduleNameMapper: {
'\\.(scss|css|jpg|jpeg|png|gif)$': 'identity-obj-proxy',
},
setupFiles: ['jest-canvas-mock'],
setupFilesAfterEnv: ['jest-extended', '@testing-library/jest-dom'],
testEnvironment: 'jsdom',
testEnvironmentOptions: {
customExportConditions: ['node', 'require', 'default'],
},
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/*.test.[jt]s?(x)'],
testPathIgnorePatterns: [
'/node_modules/',
'/cjs/',
'/dts/',
'/esm/',
'/lib/',
'/mjs/',
'/__fixtures__/',
'.*\\.d\\.ts',
],
testRunner: 'jest-circus/runner',
transform: {
// Required to find the root babel config when jest is ran in sub-folders
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { rootMode: 'upward' }],
},
clearMocks: true,
restoreMocks: true,
passWithNoTests: true,
cacheDirectory: '.nx/cache/tools/jestTransforms',
coverageThreshold: {
global: {
branches: 5,
functions: 5,
lines: 5,
statements: 5,
},
},
coverageReporters: isCI ? ['text-summary', ['text', { file: 'coverage.txt' }]] : undefined,
};
module.exports = config;