|
1 |
| -export default { |
2 |
| - roots: [ |
3 |
| - '<rootDir>/test' |
4 |
| - ], |
5 |
| - testMatch: [ |
6 |
| - '**/?(*.)+(spec|test).+(ts|tsx)' |
7 |
| - ], |
8 |
| - transform: { |
9 |
| - '^.+\\.(ts|tsx)$': 'ts-jest' |
10 |
| - }, |
| 1 | +/** |
| 2 | + * @see https://jestjs.io/docs/configuration |
| 3 | + */ |
| 4 | + const config = { |
| 5 | + // The directory where Jest should store its cached dependency information. |
| 6 | + cacheDirectory: '.jest', |
| 7 | + |
| 8 | + /** |
| 9 | + * Automatically clears all information stored in the mockFn.mock.calls, mockFn.mock.instances and mockFn.mock.results arrays before every test. |
| 10 | + * Often this is useful when you want to clean up a mocks usage data between two assertions. |
| 11 | + * Beware that this will replace mockFn.mock, not just these three properties! |
| 12 | + * You should, therefore, avoid assigning mockFn.mock to other variables, temporary or not, to make sure you don't access stale data. |
| 13 | + * |
| 14 | + * @see https://jestjs.io/docs/configuration#clearmocks-boolean |
| 15 | + * @see https://jestjs.io/docs/jest-object#jestclearallmocks |
| 16 | + * @see https://jestjs.io/docs/mock-function-api#mockfnmockclear |
| 17 | + */ |
| 18 | + clearMocks: true, |
| 19 | + |
| 20 | + // Indicates whether the coverage information should be collected while executing the test |
11 | 21 | collectCoverage: true,
|
| 22 | + |
| 23 | + // The directory where Jest should output its coverage files |
12 | 24 | coverageDirectory: '.coverage',
|
13 |
| - coverageProvider: 'v8', |
14 |
| - coveragePathIgnorePatterns: ['/node_modules/'], |
| 25 | + |
| 26 | + // A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used. |
15 | 27 | coverageReporters: ['text', 'lcov'],
|
16 |
| - cacheDirectory: '.jest_cache' |
17 |
| -} |
| 28 | + |
| 29 | + /** |
| 30 | + * This will be used to configure minimum threshold enforcement for coverage results. |
| 31 | + * Thresholds can be specified as global, as a glob, and as a directory or file path. |
| 32 | + * If thresholds aren't met, jest will fail. |
| 33 | + * Thresholds specified as a positive number are taken to be the minimum percentage required. |
| 34 | + * Thresholds specified as a negative number represent the maximum number of uncovered entities allowed. |
| 35 | + */ |
| 36 | + coverageThreshold: { |
| 37 | + global: { |
| 38 | + branches: 80, |
| 39 | + functions: 80, |
| 40 | + lines: 80, |
| 41 | + statements: -10, |
| 42 | + }, |
| 43 | + }, |
| 44 | + |
| 45 | + moduleNameMapper: { |
| 46 | + 'src/(.*)': '<rootDir>/src/$1', |
| 47 | + }, |
| 48 | + |
| 49 | + // A preset that is used as a base for Jest's configuration. |
| 50 | + preset: 'ts-jest', |
| 51 | + |
| 52 | + // A list of paths to directories that Jest should use to search for files in. |
| 53 | + roots: ['<rootDir>/test'], |
| 54 | + |
| 55 | + // The glob patterns Jest uses to detect test files. |
| 56 | + testMatch: ['**/?(*.)+(test).+(ts|tsx)'], |
| 57 | + |
| 58 | + verbose: true, |
| 59 | +}; |
| 60 | + |
| 61 | +export default config; |
0 commit comments