-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathjest.config.cjs
More file actions
52 lines (51 loc) · 1.87 KB
/
jest.config.cjs
File metadata and controls
52 lines (51 loc) · 1.87 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
const { compilerOptions } = require('./tsconfig.json');
const { pathsToModuleNameMapper } = require('ts-jest');
const esModules = ['lodash-es', 'nanoid', 'unified', 'rehype-parse', 'remark-parse', 'remark-gfm', 'hast-.*', 'mdast-.*', 'unist-.*', 'vfile', 'bail', 'is-plain-obj', 'trough', 'micromark', 'decode-named-character-reference', 'character-entities', 'mdast-util-.*', 'micromark-.*', 'ccount', 'escape-string-regexp', 'markdown-table', 'devlop', 'zwitch', 'longest-streak', 'trim-lines'].join('|');
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
roots: ['<rootDir>'],
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: {
'^.+\\.svg$': '<rootDir>/src/__mocks__/svgrMock.tsx',
'^@/utils/runtime-config$': '<rootDir>/src/__mocks__/runtime-config.ts',
...pathsToModuleNameMapper(compilerOptions.paths),
'^lodash-es(/(.*)|$)': 'lodash$1',
'^nanoid(/(.*)|$)': 'nanoid$1',
'^dayjs$': '<rootDir>/node_modules/dayjs/dayjs.min.js',
},
'transform': {
'^.+\\.(j|t)sx?$': ['ts-jest', {
tsconfig: {
esModuleInterop: true,
allowSyntheticDefaultImports: true,
},
}],
'(.*)/node_modules/nanoid/.+\\.(j|t)sx?$': 'ts-jest',
},
'transformIgnorePatterns': [
`node_modules/(?!.pnpm|${esModules})`,
],
testMatch: ['**/*.test.ts', '**/*.test.tsx'],
testPathIgnorePatterns: ['/node_modules/', '\\.integration\\.test\\.ts$'],
coverageDirectory: '<rootDir>/coverage/jest',
collectCoverage: true,
coverageProvider: 'v8',
coveragePathIgnorePatterns: [
'/cypress/',
'/coverage/',
'/node_modules/',
'/__tests__/',
'/__mocks__/',
'/__fixtures__/',
'/__helpers__/',
'/__utils__/',
'/__constants__/',
'/__types__/',
'/__mocks__/',
'/__stubs__/',
'/__fixtures__/',
'/application/folder-yjs/',
],
};