forked from openMF/web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.ts
More file actions
89 lines (72 loc) · 2.77 KB
/
jest.config.ts
File metadata and controls
89 lines (72 loc) · 2.77 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* Jest configuration in TypeScript with full type safety
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
import type { Config } from 'jest';
const config: Config = {
// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
'src/app/**/*.ts',
'!src/app/**/*.spec.ts',
'!src/app/**/*.module.ts',
'!src/app/**/*.interface.ts',
'!src/app/**/*.model.ts'
],
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// A path to a module which exports an async function that is triggered once before all test suites
globalSetup: 'jest-preset-angular/global-setup',
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
'^app/(.*)$': '<rootDir>/src/app/$1',
'^@/(.*)$': '<rootDir>/src/$1',
'^@pipes/(.*)$': '<rootDir>/src/app/pipes/$1',
'^environments/(.*)$': '<rootDir>/src/environments/$1'
},
// An array of directory names to be searched recursively up from the requiring module's location
moduleDirectories: [
'node_modules',
'src'
],
// An array of file extensions your modules use
moduleFileExtensions: [
'ts',
'html',
'js',
'json',
'mjs'
],
// A preset that is used as a base for Jest's configuration
preset: 'jest-preset-angular',
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'],
// The test environment that will be used for testing
testEnvironment: 'jsdom',
// The glob patterns Jest uses to detect test files
testMatch: [
'<rootDir>/src/app/**/*.spec.ts',
'<rootDir>/src/app/**/*.test.ts'
],
// A map from regular expressions to paths to transformers
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/src/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$'
}
]
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: [
'node_modules/(?!.*\\.mjs$|@angular|@fortawesome|@material/web|lit|lit-element|lit-html|@lit|@lit-labs)'
]
};
export default config;