-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathjest.config.js
More file actions
84 lines (83 loc) · 3.06 KB
/
jest.config.js
File metadata and controls
84 lines (83 loc) · 3.06 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
const consoleReporterRules = require('./test/jest/console-reporter-rules-unit');
module.exports = {
collectCoverageFrom: [
'<rootDir>/app/scripts/**/*.(js|ts|tsx)',
'<rootDir>/app/offscreen/**/*.(js|ts|tsx)',
'<rootDir>/shared/**/*.(js|ts|tsx)',
'<rootDir>/ui/**/*.(js|ts|tsx)',
'<rootDir>/development/build/transforms/**/*.js',
'<rootDir>/development/metamaskbot-build-announce/**/*.(js|ts)',
'<rootDir>/test/unit-global/**/*.test.(js|ts|tsx)',
],
coverageDirectory: './coverage/unit',
coveragePathIgnorePatterns: ['.stories.*', '.snap$'],
coverageReporters: ['html', 'json'],
moduleNameMapper: {
// Mock lightweight-charts since it requires browser/canvas APIs not available in Jest
'^lightweight-charts$': '<rootDir>/test/mocks/lightweight-charts.js',
},
// The path to the Prettier executable used to format snapshots
// Jest doesn't support Prettier 3 yet, so we use Prettier 2
prettierPath: require.resolve('prettier-2'),
reporters: [
// Console baseline reporter MUST be first to capture raw console messages
// before jest-clean-console-reporter processes them
[
'<rootDir>/test/jest/console-baseline-reporter.js',
{
testType: 'unit',
},
],
[
'jest-clean-console-reporter',
{
rules: consoleReporterRules,
},
],
'summary',
[
'jest-junit',
{
outputDirectory: 'test/test-results/',
outputName: 'junit.xml',
addFileAttribute: 'true',
},
],
],
// TODO: enable resetMocks
// resetMocks: true,
restoreMocks: true,
setupFiles: [
'jest-canvas-mock',
'<rootDir>/test/setup.js',
'<rootDir>/test/env.js',
],
setupFilesAfterEnv: ['<rootDir>/test/jest/setup.js'],
testMatch: [
'<rootDir>/app/scripts/**/*.test.(js|ts|tsx)',
'<rootDir>/app/offscreen/**/*.test.(js|ts|tsx)',
'<rootDir>/shared/**/*.test.(js|ts|tsx)',
'<rootDir>/ui/**/*.test.(js|ts|tsx)',
'<rootDir>/development/**/*.test.(js|ts|tsx)',
'<rootDir>/test/unit-global/**/*.test.(js|ts|tsx)',
'<rootDir>/test/e2e/helpers.test.js',
'<rootDir>/test/e2e/helpers/**/*.test.(js|ts|tsx)',
'<rootDir>/test/e2e/benchmarks/**/*.test.(js|ts|tsx)',
'<rootDir>/test/e2e/feature-flags/**/*.test.(js|ts|tsx)',
'<rootDir>/test/e2e/playwright/llm-workflow/**/*.test.(js|ts|tsx)',
],
testPathIgnorePatterns: ['<rootDir>/development/webpack/'],
testTimeout: 5500,
// We have to specify the environment we are running in, which is jsdom. The
// default is 'node'. This can be modified *per file* using a comment at the
// head of the file. So it may be worthwhile to switch to 'node' in any
// background tests. `jest-fixed-jsdom` is an improved version of jsdom.
testEnvironment: 'jest-fixed-jsdom',
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
},
workerIdleMemoryLimit: '500MB',
// Ensure console output is buffered (not streamed) so reporters can access testResult.console
// Without this, Jest uses verbose mode for single-file runs which bypasses buffering
verbose: false,
};