2024-04-29 06:32:14 +00:00
|
|
|
const { compilerOptions } = require('./tsconfig.json');
|
|
|
|
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
|
|
const esModules = ['lodash-es', 'nanoid'].join('|');
|
|
|
|
|
|
|
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
|
|
module.exports = {
|
|
|
|
preset: 'ts-jest',
|
2024-06-06 09:48:58 +00:00
|
|
|
testEnvironment: 'jsdom',
|
2024-04-29 06:32:14 +00:00
|
|
|
roots: ['<rootDir>'],
|
|
|
|
modulePaths: [compilerOptions.baseUrl],
|
|
|
|
moduleNameMapper: {
|
|
|
|
...pathsToModuleNameMapper(compilerOptions.paths),
|
|
|
|
'^lodash-es(/(.*)|$)': 'lodash$1',
|
|
|
|
'^nanoid(/(.*)|$)': 'nanoid$1',
|
|
|
|
},
|
|
|
|
'transform': {
|
2024-06-06 09:48:58 +00:00
|
|
|
'^.+\\.(j|t)sx?$': 'ts-jest',
|
2024-04-29 06:32:14 +00:00
|
|
|
'(.*)/node_modules/nanoid/.+\\.(j|t)sx?$': 'ts-jest',
|
|
|
|
},
|
|
|
|
'transformIgnorePatterns': [`/node_modules/(?!${esModules})`],
|
2024-06-06 09:48:58 +00:00
|
|
|
testMatch: ['**/*.test.ts', '**/*.test.tsx'],
|
2024-06-03 03:20:45 +00:00
|
|
|
coverageDirectory: '<rootDir>/coverage/jest',
|
|
|
|
collectCoverage: true,
|
2024-06-06 09:48:58 +00:00
|
|
|
coverageProvider: 'v8',
|
|
|
|
coveragePathIgnorePatterns: [
|
|
|
|
'/cypress/',
|
|
|
|
'/coverage/',
|
|
|
|
'/node_modules/',
|
|
|
|
'/__tests__/',
|
|
|
|
'/__mocks__/',
|
|
|
|
'/__fixtures__/',
|
|
|
|
'/__helpers__/',
|
|
|
|
'/__utils__/',
|
|
|
|
'/__constants__/',
|
|
|
|
'/__types__/',
|
|
|
|
'/__mocks__/',
|
|
|
|
'/__stubs__/',
|
|
|
|
'/__fixtures__/',
|
|
|
|
'/application/folder-yjs/',
|
|
|
|
],
|
2024-04-29 06:32:14 +00:00
|
|
|
};
|