diff --git a/jest.config.ts b/jest.config.ts index 28ff43b..e673f24 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,6 +1,8 @@ import type { JestConfigWithTsJest } from "ts-jest"; import { pathsToModuleNameMapper } from "ts-jest"; +import { compilerOptions } from "./tsconfig.json"; + const MIN_COVERAGE = 80; const config: JestConfigWithTsJest = { @@ -21,9 +23,8 @@ const config: JestConfigWithTsJest = { collectCoverageFrom: ["src/**/*.ts"], setupFiles: [".jest/set-env-vars.ts"], clearMocks: true, - moduleNameMapper: pathsToModuleNameMapper({ - "@src/*": ["src/*"], - }), + modulePaths: [compilerOptions.baseUrl], + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths), }; export default config; diff --git a/tsconfig.json b/tsconfig.json index 0519c08..3daca9d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,9 +8,10 @@ "outDir": "dist", "sourceMap": true, "inlineSources": true, + "resolveJsonModule": true, "paths": { - "@src/*": ["src/*"], - }, + "@src/*": ["src/*"] + } }, - "exclude": ["node_modules", "dist"], + "exclude": ["node_modules", "dist"] }