-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
48 lines (42 loc) · 1.49 KB
/
jest.config.js
File metadata and controls
48 lines (42 loc) · 1.49 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
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
/** @type {import('jest').Config} */
const config = {
// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// A preset that is used as a base for Jest's configuration
preset: 'ts-jest',
// The test environment that will be used for testing
testEnvironment: 'jsdom',
// Collect files for testing
collectCoverageFrom: ['src/**/*.tsx', '!**/node_modules/**'],
// Resolve Mapper for files Jest can't parse for testing
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/test/__mocks__/fileMock.ts',
'\\.(css|less)$': '<rootDir>/test/__mocks__/styleMock.ts',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: 'ts-jest-mock-import-meta',
options: { metaObjectReplacement: { url: 'https://www.url.com' } },
},
],
},
},
],
},
};
export default config;