-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
95 lines (75 loc) · 2.89 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
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
90
91
92
93
94
95
module.exports = {
// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,
// The bail config option can be used here to have Jest stop running tests after the first failure.
bail: false,
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
// Indicates whether each individual test should be reported during the run.
verbose: true,
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
// A list of reporter names that Jest uses when writing coverage reports.
coverageReporters: [
"json",
"lcov",
"text",
"text-summary",
"html",
"cobertura",
],
collectCoverageFrom: ["<rootDir>/src/**/*.js"],
// Indicates which provider should be used to instrument code for coverage
// coverageProvider: "v8",
coverageProvider: "babel",
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.csv": "<rootDir>/jest.csv-transformer.js",
},
testTimeout: 1000,
globals: {
globalVar: "a global variable",
},
snapshotFormat: {
printBasicPrototype: false,
},
moduleFileExtensions: ["js", "jsx"],
moduleDirectories: ["node_modules", "bower_components", "shared"],
// 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: {
// Add this line to map the Common directory
"^Common/(.*)$": "<rootDir>/src/Common/$1",
// Keep your existing moduleNameMapper settings
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/__mocks__/fileMock.js",
"\\.(scss|sass|css)$": "identity-obj-proxy",
"^axios$": "axios/dist/node/axios.cjs",
},
transformIgnorePatterns: [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$",
],
// If the test path matches any of the patterns, it will be skipped.
testPathIgnorePatterns: ["<rootDir>/config/env/", "<rootDir>/node_modules/"],
// If the file path matches any of the patterns, coverage information will be skipped.
coveragePathIgnorePatterns: ["<rootDir>/node_modules/"],
// The testMatch pattern or array of patterns that Jest uses to detect test files
testMatch: [
"<rootDir>/src/**/*.(test).{js,jsx,ts,tsx}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}",
],
// The test environment that will be used for testing
testEnvironment: "jsdom",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href.
testEnvironmentOptions: {
url: "http://localhost/",
},
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ["<rootDir>/src/setupTests.js"],
};