2023-09-12 12:49:03 +00:00
|
|
|
const { compilerOptions } = require('./tsconfig.json');
|
|
|
|
const { pathsToModuleNameMapper } = require("ts-jest");
|
2023-12-18 09:44:47 +00:00
|
|
|
const esModules = ["lodash-es", "nanoid"].join("|");
|
2023-09-12 12:49:03 +00:00
|
|
|
|
|
|
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
|
|
module.exports = {
|
|
|
|
preset: 'ts-jest',
|
|
|
|
testEnvironment: 'node',
|
|
|
|
roots: ['<rootDir>'],
|
|
|
|
modulePaths: [compilerOptions.baseUrl],
|
2023-12-18 09:44:47 +00:00
|
|
|
moduleNameMapper: {
|
|
|
|
...pathsToModuleNameMapper(compilerOptions.paths),
|
|
|
|
"^lodash-es(/(.*)|$)": "lodash$1",
|
|
|
|
"^nanoid(/(.*)|$)": "nanoid$1",
|
|
|
|
},
|
2023-09-12 12:49:03 +00:00
|
|
|
"transform": {
|
|
|
|
"(.*)/node_modules/nanoid/.+\\.(j|t)sx?$": "ts-jest"
|
|
|
|
},
|
2023-12-18 09:44:47 +00:00
|
|
|
"transformIgnorePatterns": [`/node_modules/(?!${esModules})`],
|
2023-09-12 12:49:03 +00:00
|
|
|
"testRegex": "(/__tests__/.*\.(test|spec))\\.(jsx?|tsx?)$",
|
|
|
|
};
|