-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.js
More file actions
63 lines (44 loc) · 2.2 KB
/
Copy pathjest.config.js
File metadata and controls
63 lines (44 loc) · 2.2 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
import dotenv from 'dotenv';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
dotenv.config({ path: join(__dirname, '.test.env') });
/** @type {import('jest').Config} */
const 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,
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/', '/build/', '/dist/'],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// Show test progress
verbose: true,
// 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: {
'^node:sea$': '<rootDir>/src/__mocks__/node/sea.js',
},
// Use this configuration option to add custom reporters to Jest
reporters: ['default', ['jest-junit', { outputDirectory: './test-results' }]],
// The root directory that Jest should scan for tests and modules within
roots: ['<rootDir>/src/__tests__'],
// The paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.js'],
// The number of seconds after which a test is considered as slow and reported as such in the results.
slowTestThreshold: 5,
// The test environment that will be used for testing
testEnvironment: 'jest-environment-node',
// Adds a location field to test results
testLocationInResults: true,
// The glob patterns Jest uses to detect test files
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
// Ignore node_modules
testPathIgnorePatterns: ['/node_modules/'],
// Whether to use watchman for file crawling
watchman: true,
};
export default config;