forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.json
77 lines (59 loc) · 3.01 KB
/
jest.config.json
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
{
// 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
"preset": "<rootDir>/config/jest-preset.js",
// 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"],
// Retain pre-Jest 29 snapshot behavior
"snapshotFormat": {
"escapeString": true,
"printBasicPrototype": true
},
"testEnvironmentOptions": {
"url": "http://localhost/"
},
"testMatch": ["<rootDir>/lib/**/*.test.cjs"],
"testPathIgnorePatterns": ["/node_modules/"],
// Code coverage tracking is disabled by default; set this to true to enable it
// This is set to true in the preset for the "heft" package
// "collectCoverage": false,
"coverageDirectory": "<rootDir>/coverage",
"collectCoverageFrom": [
"lib/**/*.cjs",
"!lib/**/*.test.cjs",
"!lib/**/test/**",
"!lib/**/__tests__/**",
"!lib/**/__fixtures__/**",
"!lib/**/__mocks__/**"
],
"coveragePathIgnorePatterns": ["/node_modules/"],
"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, 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)$": "../node_modules/@rushstack/heft-jest-plugin/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)$": "../node_modules/@rushstack/heft-jest-plugin/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 .cjs
"moduleFileExtensions": ["cjs", "js", "json", "node"],
// When using the heft-jest-plugin, these will be replaced with the resolved module location
"setupFiles": ["../node_modules/@rushstack/heft-jest-plugin/lib/exports/jest-global-setup.js"],
// When using the heft-jest-plugin, these will be replaced with the resolved module location
"resolver": "../node_modules/@rushstack/heft-jest-plugin/lib/exports/jest-improved-resolver.js"
}