forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest-shared.config.json
More file actions
85 lines (65 loc) · 3.29 KB
/
jest-shared.config.json
File metadata and controls
85 lines (65 loc) · 3.29 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
{
// THIS SHARED JEST CONFIGURATION FILE IS INTENDED TO BE REFERENCED BY THE JEST CONFIGURATION IN
// CONSUMING PACKAGE AND REQUIRES PRESET-RELATIVE MODULE RESOLUTION TO BE ENABLED. IF YOU HAVE
// DISABLED THIS FEATURE YOU MUST CREATE YOUR OWN JEST CONFIGURATION
// By default, don't hide console output
"silent": false,
// In order for HeftJestReporter to receive console.log() events, we must set verbose=false
"verbose": false,
// If mocks are not cleared between tests, it opens the door to accidental reliance on
// ordering of tests or describe blocks, eventually resulting in intermittent failures.
//
// We suggest this setting for any heft project (in a monorepo or not).
"clearMocks": true,
// "Adding '<rootDir>/lib' here enables lib/__mocks__ to be used for mocking Node.js system modules
"roots": ["<rootDir>/lib"],
"testMatch": ["<rootDir>/lib/**/*.test.{cjs,js}"],
"testPathIgnorePatterns": ["/node_modules/"],
// Code coverage tracking is disabled by default; set this to true to enable it
"collectCoverage": false,
"coverageDirectory": "<rootDir>/temp/coverage",
// Use V8 instead of Babel to avoid the overhead of instrumenting code
"coverageProvider": "v8",
"collectCoverageFrom": [
"lib/**/*.{cjs,js}",
"!lib/**/*.d.ts",
"!lib/**/*.test.{cjs,js}",
"!lib/**/test/**",
"!lib/**/__tests__/**",
"!lib/**/__fixtures__/**",
"!lib/**/__mocks__/**"
],
"coveragePathIgnorePatterns": ["/node_modules/"],
"testEnvironment": "jest-environment-node",
"testEnvironmentOptions": {
"url": "http://localhost/",
"customExportConditions": ["require", "node"]
},
// Retain pre-Jest 29 snapshot behavior
"snapshotFormat": {
"escapeString": true,
"printBasicPrototype": true
},
"snapshotResolver": "../lib/exports/jest-source-map-snapshot-resolver.js",
// Instruct jest not to run the transformer pipeline by default on JS files. The output files from TypeScript
// will already be fully transformed, so this avoids redundant file system operations.
"transformIgnorePatterns": ["\\.c?js$"],
// jest-identity-mock-transform returns a proxy for exported key/value pairs, where Webpack would return a module
// jest-string-mock-transform returns the filename, relative to the current working directory, where Webpack would return a URL
// When using the heft-jest-plugin, these will be replaced with the resolved module location
"transform": {
"\\.(css|sass|scss)$": "../lib/exports/jest-identity-mock-transform.js",
"\\.(aac|eot|gif|jpeg|jpg|m4a|mp3|mp4|oga|otf|png|svg|ttf|wav|webm|webp|woff|woff2)$": "../lib/exports/jest-string-mock-transform.js"
},
// The modulePathIgnorePatterns below accepts these sorts of paths:
// - <rootDir>/lib
// - <rootDir>/lib/file.js
// ...and ignores anything else under <rootDir>
"modulePathIgnorePatterns": [],
// Prefer .cjs to .js to catch explicit commonjs output. Optimize for local files, which will be .js
"moduleFileExtensions": ["cjs", "js", "json", "node"],
// When using the heft-jest-plugin, these will be replaced with the resolved module location
"setupFiles": ["../lib/exports/jest-global-setup.js"],
// When using the heft-jest-plugin, these will be replaced with the resolved module location
"resolver": "../lib/exports/jest-improved-resolver.js"
}