related serverices to TS

This commit is contained in:
Alex Holliday committed 2026-01-15 22:33:25 +00:00
1 parent cf67c82f5e
commit ed80837810
6 files changed
+162 -114

No files matched your search

+6 -10
View File
@@ -1,14 +1,5 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { pathsToModuleNameMapper } from "ts-jest";
import type { Config } from "jest";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const tsconfigPath = path.resolve(__dirname, "./tsconfig.json");
const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
const config: Config = {
rootDir: ".",
testEnvironment: "node",
@@ -17,7 +8,12 @@ const config: Config = {
"^.+\\.(t|j)sx?$": ["ts-jest", { useESM: true, tsconfig: "./tsconfig.jest.json" }],
},
moduleNameMapper: {
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths || {}, { prefix: "<rootDir>/" }),
"^@/validation/(.*)\\.js$": "<rootDir>/src/validation/$1.js",
"^@/utils/(AppError)\\.js$": "<rootDir>/src/utils/$1.ts",
"^@/utils/(.*)\\.js$": "<rootDir>/src/utils/$1.js",
"^@/(.*)\\.ts$": "<rootDir>/src/$1.ts",
"^@/(.*)\\.js$": "<rootDir>/src/$1.ts",
"^@/(.*)$": "<rootDir>/src/$1",
},
testMatch: ["<rootDir>/test/**/*.test.ts"],
setupFilesAfterEnv: [],